Doing emergent design is an advanced practice that requires knowledge of a great many skills. One key skill that all professional software developers should acquire as they journey towards mastery is a deep understanding of design patterns, both in concept and in terms of the 23 design patterns called out by the Gang of Four in their book Design Patterns: Elements of Reusable Object-Oriented Software. Design patterns represent a type of knowledge that’s indispensable for doing emergent design because they embody how to build changeable code.
Sometimes developers ask me how, in this fast-paced world that we live in, can ideas from a book published over 20 years ago be relevant today? But I think that the ideas in the design patterns book are even more relevant today than they were when they were first introduced back in the mid-90s.
Back in the mid-90s, computers were slow in memory was expensive. We didn’t spend a lot of time building systems to be resilient through abstractions and indirect calls because we could not afford the overhead in terms of processor speed or space. The problems we were working on were much simpler back then but the systems were much more constrained and this drove us the focus on efficiency at all costs.
If you meet an old-timer like me in the software industry you have to be careful because when I was learning to be a professional software developer, the skills that made me excellent are actually skills that hold me back today. A lot of developers who have been in the industry as long as I have, tend to overly emphasize the performance characteristics of software because we grew up in an era where that was important.
But today we’re less concerned about performance and more concerned about the understandability of our code, it’s maintainability and its extensibility. It would be nice if we could have everything but life doesn’t work that way. We have to make trade-offs and as a result, we find that it is more cost-effective today to build software that is understandable and extensible, even if it is a bit less performant.
I do feel a bit embarrassed that I didn’t get on the design patterns bandwagon until about 2003 or 2004 but when I did get into it, I got deeply into it. I learned about design patterns from Al Shalloway and Scott Bain at Net Objectives. I believe they have some very unique and powerful perspectives on what design patterns are and how to use them effectively, both in code and to help us understand designs more deeply.
One of the most powerful ways that I have learned to use design patterns is for encapsulating variation within a program. Variation is the thing that adds complexity to software. It also helps give software its usefulness. One way to see design patterns is as techniques for encapsulating different kinds of variations or as Scott Bain likes to say, “Design patterns make something that is varying appear to the outside as if it isn’t varying.”
I find that I use most of the 23 design patterns called out by the Gang of Four quite often. But even more valuable than those patterns is the notion of patterns in general, and how it has helped influence the way I think and understand. Patterns are about their intent, not their implementation, and being able to separate those two things out has become a major part of the way I think and understand not only software systems but also the world. I think this has helped me gain a lot of clarity about a range of areas.
Design patterns are one of my favorite subjects. They contribute significantly to my software developer superpowers. They also contribute to my general cognitive skills and my understanding in general. Design patterns are great examples of high-quality code that’s flexible. They draw on good design principles.
The Gang of Four design patterns truly embodies the essence of object-oriented programming. In fact, I really didn’t understand object-oriented programming until I got introduced to design patterns and saw how to create complex behavior in a system through the interaction of objects rather than through just straight logic.
I would say that having a deep understanding of design patterns is a key prerequisite for doing emergent design effectively. Unfortunately, while there are many books on software design, there is no easy recipe for doing emergent design. It’s an advanced practice that requires many skills.
Note: This blog post is based on one of the “Seven Strategies…” sections in my book, Beyond Legacy Code: Nine Practices to Extend the Life (and Value) of Your Software.
Previous Post: « Understand Object-Oriented Design
Next Post: Understand Test-Driven Development »