Development of any feature can be broken into three basic steps:
- Get everything working, all functionality included.
- Architect some logical, testable classes / methods.
- Finish your elegant solution.
1. Get ‘everything’ working
The first step is to get all of the required functionality in.
Don’t spend too much time writing perfect code. This stage should be fast and just enough to get a basic version of your functionality implemented.
This is not to say your code should be a disgusting mess, but if you find yourself labouring over method names or what belongs where, name it `briefDescriptionChangeMeLater()` and add a
There is little point spending too much time writing perfect code at this stage, as some key element or feature you come to later on could change your entire approach.
You now have an understanding of your entire feature set, you know everything is working and there should be few surprises. Now is the time to start thinking like an architect.
Break up your code into logical classes and methods. Think carefully about how to name things, even ask your colleagues for their input. Ensure you have enough comments explaining why you’ve made the decisions you have.
3. Finish it
This is the part that you should usually probably skip, but many developers are compelled to include.
The solution is already finished, it’s well architected and feature complete. However, it could be better! It could be optimised, it could be fine tuned, it could be tweaked, etc.
It could be… perfect!
This is the moment you need to take a step back and say “is it good enough” in respect of the project you are delivering.
If your project is an every hundredth-of-a-microsecond-counts product, then yes, step 3 is crucial. If your project is a WordPress blog like this one, then you’re done. Move on.
4+. BDD / TDD
Included for completeness, add some behaviour driven / test driven development into this process from step one and you’re golden! However this is too big a topic beyond the scope of this article.