What is Agile Designleena
September 15, 2013
Agile recommends to do design continuously and emerge your design instead of doing a Big Design UpFront (BDUF). This post is an attempt to explain how to achieve the same.
Start with Simple Design
Extreme Programming recommends you to Do The Simplest Thing That Could Possibly Work, known with the acronym (DTSTTCPW).
As mentioned by Ron Jeffries, the code is simple if it:
- Run all the tests
- Contain no duplicate code
- Express all the ideas the author wants to express
- Minimize classes and methods
The first 3 rules are self explanatory but the fourth one is confusing and contradictory especially with related to SOLID principles and design patterns. But 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, the question is when to design. 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 where in the system to improve the design. The simple heuristic I have found helpful is to eliminate duplication. If 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 initially, refactor the code meticulously by applying the principles DRY and Once and Only Once. Improve the code further by using tools to identify Cyclomatic Complexity and Afferent Coupling. Follow Test Driven Development which helps to do enough design required for the current requirement. Test coverage gives confidence to re factor the code without fear.