Use uncertainty as a driver
People usally think that the most important thing about the presence of two options is making a choice between them. In design (software or otherwise), it is not. The presence of two options is an indicator that you need to consider uncertainty in the design. Use the uncertainty as a driver to determine where you can defer commitment to details and where you can reduce the significance of design decisions. If you hardwire the first thing that comes to mind, you're more likely to be stuck with it so that incidental decisions become significant and the softness of the software is hardened.
There are many definitions of architecture. One of the simplest and most constructive comes from Grady Booch: "All architecture is design but not all design is architecture. Architecture represents the significant design decisions that shape a system, where significant is measured by cost of change." What follows from this is that an effective architecture is one that generally reduces the significance of design decisions. Consider that a system may be subject to frequent change, with certain design decisions being revisited. Of itself this need not be a problem, but it becomes a problem if redesigning involves significant rather than modest changes that are more easily absorbed into schedule and budget. Without paying close attention to the partitioning, incidental decisions that should be minor can escalate into architectural decisions that are difficult to change. Significant changes are ones that appear on the radar. They can range from being a constant source of deceleration, reducing project velocity, to more disruptive, upsetting the schedule and the viability of a product.
Uncertainty and change can amplify the significance of design decisions. When a design decision can reasonably go one of two ways, an architect needs to take a step back. Instead of trying to decide between options A and B, the question becomes "How do I design so that the choice between A and B is less significant?" The most interesting thing is not the actual choice between A and B, but the fact that there is a choice between A and B and that the correct choice is not immediately apparent.
Uncertainty is not always immediately obvious. Sometimes an architect needs to go in circles before becoming dizzy and recognizing the dichotomy. Standing at whiteboard (energetically) debating options with a colleague? Umming and ahhing in front of some code, deadlocked over whether to try one implementation or another? When a new requirement or a clarification of a requirement has cast doubt on the wisdom of a current implementation, that's uncertainty.
When faced with uncertainty, use that as a driver in design. Take a step back and figure out what separation or encapsulation would isolate that decision from the code that ultimately depends on it. This step back is important. Without it the response is often rambling code that, like a nervous interviewee, babbles away trying to compensate for uncertainty with a multitude of speculative and general options. Or, where a response is made with arbitrary but unjustified confidence, a wrong turn is taken at speed and without looking back.
It is worth keeping in mind that uncertainty has many sources, both technical and non-technical. Some requirements may be vague or open, and clarification one way or another may at first suggest two competing designs rather than a single design with minor variation. The effect of a design on performance and other operational qualities can be difficult to predict, and different approaches may need to be explored.
There is often pressure to make a decision for decision's sake. This is where options thinking can help. Where there is uncertainty over different paths a system's development might take, take a decision to take a decision. Defer the actual decision until a decision can be taken more responsibly, based on actual knowledge, but not so late that it is not possible to take advantage of the knowledge.
Architecture and process are interwoven, which is a key reason that architects should favor a development lifecycle and an architectural approach that is empirical and elicits feedback, using uncertainty constructively to divide up both the system and the schedule.
By Kevlin Henney (Edited RMH 5/28/2008)
This work is licensed under a Creative Commons Attribution 3
Back to 97 Things Every Software Architect Should Know home page