Of course, the biggest problems in software design would revolve around new problems that no one has ever encountered before. The truth, however, is that most developers tend to run into the same issues – and make the same mistakes – over and over again. This is what prompted programmers to create software design patterns that the community at large could adopt as standardized, reusable solutions to common development hurdles.
For decades, the software development community has created a multitude of these generally accepted models, such as those established by the famous “Gang of Four” – Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides – in their 1994 book entitled Design Patterns: Reusable Object-Oriented Software Elements. Unfortunately, to use these models effectively, it is not enough to know the details of each one, but also to understand why these models exist and why they are important.
In Head First Design Patterns, 2nd edition, authors Elisabeth Robson and Eric Freeman explored the various principles and techniques associated with these problem-solving design models, specifically intended for newcomers to the field of object-oriented programming. The goal, they said, was to give developers a different perspective on code structuring habits, all with an emphasis on proper object-oriented design.
In this Q&A, Robson and Freeman discuss the critical importance of understanding not only the software design models themselves, but also the underlying object-oriented principles that form the basis of these models. They also discuss who they wanted to reach through this book, their motivations for writing it and, finally, what they want their readers to take away.
Editor’s Note: This transcript has been edited for length and clarity.
The book goes to great lengths to present not only the patterns of software design in general, but also the philosophy of object-oriented design – why is this concept so important?
Eric Freeman: As soon as we engage in a development effort of any complexity, things can very quickly get complicated with objects. We don’t want our designs to be fragile, breakable, or non-reusable; we want them to be maintainable. If we don’t have designs that really support these things, this reusability and maintainability, then we’re in a world of suffering.
Elisabeth Robson: The whole promise of object-oriented design was to be able to reuse components. Having design patterns and good object-oriented design makes this promise more achievable. Especially when you’re dealing with changes or different types of systems, but want to reuse components in a way that Eric said won’t be fragile.
Is there a certain type of developer or level of industry experience that you wanted to target with Head First Design Patterns?
Free man: [The book] is quite suitable for someone who is a beginner object-oriented programmer – so they had an introduction to the basics [object-oriented] Notions. In terms of audience, we get newbies [as well as] experienced developers who never had the time to really understand design patterns as far as they should have.
Robson: We are using Java in the book, so we assume that you know an object oriented programming language quite similar to Java, [and that you] can understand these basic concepts. But we have people from all programming backgrounds who have chosen the book: in fact, we’ve had readers who have taken our code and translated it into five or six different languages at this point. We’ve tried really hard to make our book as accessible as possible, so you don’t have to be a Java expert to understand patterns.
In the book, you call your readers “learners” – can you clarify what you mean by that?
Robson: Our book is structured so that readers build this repertoire of skills as they go, [and] it is meant to be read from start to finish. We tried to structure [the book] so that we unfold these principles on the models. Then, we build on these fundamental ideas throughout the book. This way you learn to understand how a principle and a model work together in an example. Then, later in the book, you see that [principle] again in a slightly different example of a different model.
After reading your book, what do you want your readers to leave with?
Free man: We want to build this repertoire of patterns in their heads. This does not mean that they know all the details, but they do know enough when approaching a problem. the [design pattern] catalogs are there for a reason – you don’t have to memorize that stuff. But we want our readers to have a good working knowledge of these models. [and] know that they can go and use them.
Robson: [We want them] think about the kinds of problems that you will come across in software design and the different techniques that you can use, as well as a more in-depth reflection on object-oriented basics. Develop these skills and be ready to explore further [patterns] … And hopefully be a better software developer – that’s the goal.