Managing Software Debt: Executable Design
- Principles of Executable Design
- Executable Design in Practice
- Summary
- If we are not enhancing the design then we are just writing a bunch of tests.
- —An anonymous developer in a meeting about a Test-First development implementation
Principles of Executable Design
Executable Design is an approach involving existing well-known practices, helpful principles, and a mind-set shift from traditional views on software design. There have been many projects, conversations, and mistakes involved in defining Executable Design as described in this chapter. There is always room for improvement and perspective. Please take what you can from this chapter and apply it to your own context. In fact, this is an essential principle of Executable Design:
- The way we design can always be improved.
This particular principle is not all that controversial. There is a continuous flow of writing about design methods and ideas in our industry. It does, however, suggest the notion that following a single design method is not recommended. By trying multiple methods of design, teams continue to learn and innovate for the sake of their applications.
People in our industry strive for the "best" design methods for software. This has led to many innovations that are in common use today, such as UML and Inversion of Control. In the development of these design methods many ideas were considered and changes were made along the way. In application development, teams also consider ideas and make changes based on their current understanding of the application's design. It is easy sometimes to choose an architectural design style such as Model-View-Controller (MVC), peer-to-peer, and service-oriented. But when these architectural design styles are put into practice to implement a solution of any size, many decisions must be made about specifics in the design. This has led to the following principle of Executable Design:
- We will not get it "right" the first time.
This has been shown to be true in my career in the following situations:
- Abstracting web design from application behavior
- Creating a text formatting library for portable devices
- Using model-driven development on a project
Although we will not usually get the design "right" on the first attempt, the design does tend to settle out for most applications. It has come to my attention over the years that
- We're more likely to get it "right" the third time.
I am positive that it is not always the third time, but that is not the point of this statement at all. The point is for team members to construct software so that changes can be incorporated at any point in time. If we accept that we're more likely to get the design "right" closer to the third attempt, we will build software to support change. This gets us to our next principle of Executable Design:
- Design and construct for change rather than longevity.
If software is designed and constructed for change, it will be technically and economically feasible to change the software for new needs rather than rewriting it. Designing and constructing with such discipline that changes are easily supported at any time is quite difficult. It takes tremendous discipline when patterns of technical debt, such as schedule pressure as discussed in Chapter 2, are introduced to a team. It is my opinion that we cannot rely on disciplined design over a long period of time by every team member. Therefore, our last principle of Executable Design is
- Lower the threshold of pain.
At a workshop in Grand Rapids, Michigan, on technical debt, Matt Heusser proposed that technical debt could be an outcome of individual developers not having to deal with the consequences of their actions. The decisions that we make each day in developing software lead to technical debt because of a "moral hazard."
- Moral hazard is the view that parties insulated from risk may behave differently from the way they would behave if they were fully exposed to the risk.
This does not mean that team members act in a malicious or dishonest way. It means that if individual team members are insulated from the long-term effects of a decision, they will not take as much care in the short term. Matt's example was that a person may take a shortcut in developing a feature because that person is not going to be working on the code one year from now when it must be changed to support a new feature.
Immediately following Matt's discussion on moral hazard, Chet Hendrickson pointed out that a good way to minimize the moral hazard problem is by "lowering the threshold of pain." For instance, Chet brought up how many people approach doing their taxes in the United States. They could incrementally update their tax information for two hours each month. Instead, many of us wait until two weeks prior to the deadline to complete our tax forms. We push to complete our taxes by the deadline because the potential headache of tax evasion is strong enough that a pain threshold would be crossed.
Teams can agree to a threshold of pain they are willing to tolerate and put in feedback mechanisms to let them know when that threshold is crossed. In XP, there are multiple frequencies of feedback provided. Pair programming enables team members to provide feedback within seconds. Test-Driven Development (TDD) and acceptance testing provide feedback within minutes of the changes. By using continuous integration teams are provided feedback within tens of minutes on how all of their code works together. Having an on-site customer representative in close proximity can support getting feedback on an implementation detail within hours of starting work on it. Teams working in time-boxed iterations get feedback from stakeholders within weeks. Getting feedback as close to when an action has been taken is critical to the evolutionary nature of software development using XP.
Identifying a threshold for providing feedback to the team is also a critical aspect of Executable Design. Automating the feedback, when possible, enforces the team's threshold. The feedback could be automated in each team member's development environment, the continuous integration server, and promotion of software to servers exposed to stakeholders.
On some legacy development platforms there could be costs that make frequent feedback difficult or even seemingly impractical. Teams should work toward the shortest frequency of feedback at all levels of the software development process that is practical and feasible in their context. The frequency of feedback that a team can attain is probably more than initially thought.
To recap the principles that drive Executable Design:
- The way we design can always be improved.
- We'll get it "right" the third time.
- We will not get it "right" the first time.
- Design and construct for change rather than longevity.
- Lower the threshold of pain.
Taking on the Executable Design mind-set is not easy. I continually use these principles in design discussions for products, technology, code, tests, business models, management, and life. It has been helpful for me to reflect on situations where these principles have caused me to change my position or perspective. From these reflections I have found more success in setting proper expectations, learning from others in the design process, and designing better solutions for the situation.
Teams can tailor their practices and tools and still be in alignment with the Executable Design principles. The rest of this chapter will provide a set of suggestions about practices and tools to support an Executable Design approach. By no means are these suggestions the only ways to apply the principles or the only ways that I have seen them applied. These suggestions are only examples to help clarify their application to the software development process. If they work for your current context, your team has a place to start. But please do not stop once you apply them successfully. Remember the first principle:
- The way we design can always be improved.