Code Complete 2 Review: Design in Construction (Part 3a)

So far the book Code Complete Second Edition is big on software construction. The fifth chapter of this book title “Design in Construction”, that defines “software design” as the conception, invention, or contrivance of a scheme for turning a specification for computer software into operational software, expounds on design challenges, key design concepts, design building blocks (Heuristics), design practices and comments on popular methodologies. This article summarizes the main points on each of the design items.

Design is marked by a lot of challenges that are summarized in this paragraph. Design is a wicked problem. A wicked problem is now that could be clearly defined only by solving it. Design is a sloppy process. Design is sloppy because you make a lot of mistakes and you never know when your design is “good enough”. Design is about tradeoffs and priorities, that is, in real-world, each design has its pros and cons which you need to consider before choosing one. Designs have different priorities and the choice of one design over the other might be based on priority. Design involves restrictions, which means, the point of design is partly to create possibilities and partly to restrict possibilities. Design is nondeterministic meaning that there is no single way of doing it; everyone has there own way that can be acceptable. Design is a heuristic process. Unlike science, there are no definite steps of doing design, it involves trial and error. Finally, design is emergent. Design does not come fully developed in a person’s mind, it improves over time.

For a programmer to understand design, they must understand some few concepts such as the role of complexity, desirable characteristics of design, and levels of design. Complexities are of two forms — essential and accidental complexities. In any project, complexity should be managed because the primary technical reason for project failure is complexity. Some of the desirable characteristics of design listed by Steve McConnel include minimal complexity, ease of maintenance, loose coupling, extensibility, reusability, high fan-in, low-to-medium fan-out, portability, leanness, stratification and standard techniques. There are several levels of design — software system, decision into subsystems/packages, Division into classes within packages, and finally internal routine design.

According to the book, which I completely agree with, design has building blocks which are heuristics. Since design is nondeterministic (refer to the second paragraph if you have forgotten what this is) skilful application of an effective set of heuristics is the core activity in good software design. Think of these heuristics explored in this chapter of the book as the guides for the trials in “trial and error”.

Understanding the heuristics mentioned in the book introduces one to understand the design practices. This section, in the book, talks about design practice heuristics you can take that often produce good results. You should keep in mind that design is an iterative process — you don’t move from point X to point Y; you go from point X to Y and then back to point X. Therefore, when you come up with a good first design, don’t stop there, iterate over it to make it even better. Some of the design practice heuristics discussed in the book are divide and conquer, top-down and bottom-up design approaches, experimental prototyping and collaborative design.

In conclusion, this chapter is heavy on the details highlighted in this short article. The chapter answers questions such as how much design is enough and outlines the various ways to capture your design work and gives a comment on some of the popular design methodologies. One major point of failure of software is complexity which is greatly avoided but focussing on a simpler design. Design is heuristic and iterative.