JavaRush /Java Blog /Random EN /Review of the book "Design Patterns" (Head First Design P...
Level 37

Review of the book "Design Patterns" (Head First Design Patterns)

Published in the Random EN group
Among people who are at least minimally familiar with the Head First series, there are many who consider such literature to be rather superficial reading matter for beginners. What can I say, it is unlikely that you will be able to deeply study a complex topic from the field of programming in 48 hours. However, it is hard to argue that Design Patterns is a book that will be a useful guide to programming for beginners. This book is one of the top 10 most popular books on Stackoverflow, and for good reason. The ease of presentation, the fundamental theme and high-quality examples make the book in demand now and, in my opinion, for many years to come. Review of the book "Design Patterns" (Head First Design Patterns) - 1

book features

Head first design patterns tells us what patterns are, how to use them, and how to think about them. A pattern is a template, a universal solution for a specific set of tasks. Design patterns are, in turn, commonly used architectural solutions that can be used to write convenient and flexible applications. Developers around the world solve the same problems with the same approaches. As the annotation says, if you do not want to reinvent the wheel, use ready-made design patterns (patterns) that this book is devoted to working with . Separately, it is worth noting the presentation of the material: the books of the Head First series are famous for their simplicity and are read in one breath. Design Patterns is no exception. It also follows key principles:
  1. visibility
  2. Conversational style of presentation
  3. A large number of illustrations
  4. Active participation of the reader
  5. Appeal to emotions
  6. Capturing the reader's attention
The authors of the book correctly use the theory of metacognition to present the material: for me, the first 100 pages flew by unnoticed. The beauty of the approach is that the brain actually remembers what is read. Combining several storytelling styles, interesting questions, redundancy and creativity - all this helps the reader not to lose interest in the main topic. Before buying the book, I was skeptical after reading mixed reviews. However, after skimming through several other sources on this topic, I decided: to dive into patterns, this book is what you need.

Main theme and key idea

“Surely someone has already solved your problem” - this is how the first chapter of the book begins, conveying the whole meaning of design patterns in programming. The main goal is to correctly convey their meaning to the reader, because first of all, the programmer must know what the patterns are for and at what point they need to be applied. In fact, first you need to sort out the templates in your head, and only after that you need to implement them into programs. If a novice in programming understands patterns “on a C”, using them can greatly complicate the code (and should simplify!). To the question “Why should design patterns be used?”The book gives a clear answer: “Knowing concepts like abstraction, inheritance, and polymorphism doesn't make you a good OO designer. Patterns contain proven experience in OO design.”


The book is divided into 14 chapters plus an introduction. At the beginning, the authors of the book try to prepare the reader, to tune his brain to the correct perception of information about the design of patterns. The first chapter explains the basic principle of patterns and what they serve. Easily and unobtrusively, one of the most used patterns is considered - strategy. Chapters two through eleven are devoted to a detailed analysis of individual patterns :
  1. Observer. Propagates events to objects that are interested in their occurrence.
  2. Decorator. Another look at inheritance in Java and empowering Java classes with new features without modifying the code.
  3. Factory. The pattern saves the code from unwanted dependencies.
  4. Single. Also known as Singleton, it allows you to create a single class object for the entire program.
  5. Team. The pattern allows you to conveniently encapsulate a method call, extending the possibilities.
  6. Adapter and Facade. Solving the problem of interface incompatibility, as well as packaging objects to simplify their interface.
  7. template method. Encapsulation of algorithm blocks, allowing subclasses to be associated with the desired processing algorithm at any time.
  8. Iterator and Linker. The pattern provides a convenient tool for iterating over collections, regardless of their type. Additionally, the chapter provides a portion of information about supercollections.
  9. State. Objects are endowed with the ability to control their behavior through changes in internal state.
  10. Deputy. A very handy pattern for controlling access to an object.
Chapter 12 discusses composite patterns, or more specifically, combinations of some of the patterns discussed, that can be used to build powerful software architectures. Chapter 13 is devoted to the application of patterns in real-life problems, the classification of patterns, their varieties and guidelines for use are presented. Chapter 14 serves as an appendix to the book, which deals with a wider range of patterns. Each of them is useful in its own way, so knowing them is more than desirable. Of course, they're not as popular as the patterns in chapters 2-11, but that doesn't make them any less useful. The book does not claim to be an academically accurate exposition of pattern theory. But if the books in the Head First series are so meticulous, novice developers will not have a chance to figure out what's what and clarify for themselves the basics of the basics.This is an easy and convenient way to learn what design patterns are for those who are not familiar with them. According to the authors, Design Patterns is a book that will suit those who are already familiar with Java (or C#), want to learn the principles of object-oriented design, and prefer lively conversation to boring lectures. This book is not a guide! If you are a professional developer with experience and work with at least some of these patterns, the book is unlikely to be of interest to you. An important component of the book are exercises: they should not be skipped. With a careful reading of the book and, in a pinch, a minimal search on the Internet, their solution will not add to your headache. And here is the benefit for sure. At the very least, you will understand more deeply the theory that is presented in the book.

Advantages and disadvantages

I, like many of those who study at CodeGym, have a cold attitude towards boring lectures, cramming the material and other violence against the psyche of a student who is thirsty for knowledge. The energy spent on memorizing incomprehensible texts, in my opinion, is best directed to the search for alternative sources of learning. This book is one that is worth your time and effort. An excellent style of presentation, competent management of the reader's attention, the repetition of key points form the main advantage of this book - the ease of assimilation of the material.. Lots of illustrations are an added bonus. In my opinion, in the book, each picture has its place: they all make it possible to strengthen the words of the authors and to better understand the essence of the material. As I wrote above, this book is not a reference book: its authors do not have the goal of listing all the patterns. Its main task is to give understanding and talk about the main patterns, so that the rest, more complex, are easier to perceive. And she does it 100%. Among the shortcomings, one can single out the fact that Head first design patterns in Russian are not read as smoothly as in English. Of course, every developer must speak English, but for beginner programmers, this skill is not always pumped to such an extent that they can read books in the original. Nevertheless, this can be considered a strained minus, since the material is presented quite accurately and the meaning is preserved.

Additional Books on Design Patterns

I am a supporter of the belief that it is better to study fundamental topics from several sources and look for a suitable presentation style in them. When you want to dive into patterns and read additional theory, believe me, you will have something to occupy your evenings with.
  1. Techniques of object-oriented design. Design patterns (E. Gamma, R. Helm, R. Johnson, J. Vlissides).

    Review of the book "Design Patterns" (Head First Design Patterns) - 2

    This is a more serious publication, a pattern guide, a highly respected book from the Gang of Four. Many call it the bible of OO design.

    In the network, the opinions of developers are divided into 3 camps:

    • some argue that the book is outdated, and because of the style of presentation it is impossible to read it
    • others recommend using the book solely as a reference for patterns, nothing more
    • still others say the book is the holy grail of design patterns and should be read by anyone who wants to one day become a Senior Java Developer
    I am an adherent of the second group: I think that the book is really worthy, but it is very difficult to read it for development, and not for the purpose of finding any information.

    Important:the examples in the book are written in C++.

  2. Java EE. Design Patterns for Professionals (Murat Yener, Alex Fidom).

    Book Review Head First Design Patterns - 3

    This book is all about enterprise application design, with many examples of real world application problems.

  3. Design Patterns in Java (Grand M.).

    Review of the book "Design Patterns" (Head First Design Patterns) - 4

    The book colorfully demonstrates how the use of patterns saves developers time, provides an overview of the UML, and describes 47 design patterns.

Design Patterns in CodeGym

In the CodeGym course, design patterns are studied at level 7 of the Java Collections quest. Lectures 1 and 2 are devoted to the most common patterns, and in Lecture 4 you can solve problems on this topic. Below are some interesting articles to “strengthen”:
  1. A general article on the topic of patterns with categories, examples, everything we love.

  2. Two articles on patterns: part 1 overview and more detailed part 2 .

  3. Design patterns on the example of the Singleton pattern .

  4. Articles about the pattern “ Strategy ” and “ Adapter ”.

  5. The concept of design patterns is associated with UML diagrams, this article will help you understand what it is.