Continuous Design — To Avoid Technical Cruft
- Passes all the tests
- Reveals Intention
- No Duplication
- Fewer Elements
The first three rules are self-explanatory, but the fourth one is confusing and contradictory, especially with, related to SOLID principles and design patterns. It conveys the principles YAGNI and Last Responsible Moment i.e. don’t do anything assuming that it might be required in future.
The following is the excerpt from XP Explained Book by Kent Beck on Incremental Design.
XP teams can meet their human need for immediate and frequent success as well as their economic need to defer investment to the last responsible moment. Some of the teams who read and applied the first edition of this book didn’t get the part of the message about the last responsible moment. They piled story on story as quickly as possible with the least possible investment in design. Without daily attention to design, the cost of changes does skyrocket. The result is poorly designed, brittle, hard-to-change systems.
The question is not whether or not to design, instead the question is when to design. The incremental design suggests that the most effective time to design is in the light of experience.
If small, safe steps are how to design, the next question is when to improve the design. The simple heuristic I found helpful is to eliminate duplication. I have the same logic in two places, I work with the design to understand how I can have only one copy.
Emergent Design and Continuous Design
Emergent Design — popularised by Neal Ford — the design emerges by following Last Responsible Moment and Idiomatic Patterns. Refer to his 15 article series, which talks about the same. I will write about the same, especially about the Idiomatic Patterns, in another post.
Continuous Design was the term given by James Shore. He explains the same as:
I prefer the term continuous design because it emphasizes the core of the process: continuously taking advantage of opportunities to improve your design. When you discover a design flaw, you fix it. When a new feature doesn’t fit, you update the design.
Instead of doing a big bang design phase, refactor the code meticulously by applying the Boys Scout Rule. Use tools to identify Cyclomatic Complexity and Afferent Coupling in the code. Follow Test Driven Development which helps to do enough design required for the current requirement. Test coverage gives the confidence to refactor the code.
Originally published at www.multunus.com