Features of the book
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 problems. Design patterns are, in turn, commonly used architectural solutions that can be used to write user-friendly and flexible applications. Developers all over the world solve the same problems with the same approaches. As the annotation says, if you don’t want to reinvent the wheel, use ready-made design templates (patterns), which this book is dedicated to working with . Separately, it is worth noting the presentation of the material: the books in the Head First series are famous for their simplicity and are read in one sitting. “Design Patterns” is no exception. It also adheres to the following key principles:- Visibility
- Conversational style of presentation
- A large number of illustrations
- Active reader participation
- Appeal to emotions
- Grabbing the reader's attention
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. Essentially, you first need to sort the templates into little pieces in your head, and only after that implement them into programs. If a beginner in programming has a good understanding of patterns, their use can greatly complicate the code (but should simplify it!). To the question “Why should design patterns be used?” The book gives a clear answer: “Knowing concepts like abstraction, inheritance, and polymorphism does not make you a good OO designer. The patterns contain proven OO design experience.”"Summary"
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 correctly perceive information about pattern design. The first chapter explains the basic principle of patterns and what purposes they serve. One of the most used patterns - strategy - is easily and unobtrusively examined. Chapters two to eleven are devoted to a detailed analysis of individual patterns :- Observer. Distributes events across objects that are interested in their occurrence.
- Decorator. Another look at inheritance in Java and giving Java classes new capabilities without modifying the code.
- Factory. The pattern saves the code from unwanted dependencies.
- Single. Also known as Singleton, it allows you to create a single class object for the entire program.
- Team. The pattern allows you to conveniently encapsulate a method call, expanding its capabilities.
- Adapter and Facade. Solving the problem of interface incompatibility, as well as packaging objects to simplify their interface.
- Template method. Encapsulation of algorithmic blocks, allowing subclasses to associate with the desired processing algorithm at any time.
- Iterator and Linker. The pattern provides a convenient tool for iterating through collections, regardless of their type. Additionally, the chapter provides some information about supercollections.
- State. Objects are endowed with the ability to control their behavior through changes in their internal state.
- Deputy. A very convenient pattern for controlling access to an object.
Advantages and disadvantages
I, like many of those who study at JavaRush, have a cold attitude towards boring lectures, cramming material and other violence against the psyche of a student thirsty for knowledge. The energy spent on memorizing incomprehensible texts, in my opinion, is best spent on finding alternative sources of learning. This book is one that is worth your time and effort. An excellent presentation style, competent management of the reader’s attention, and repetition of key points form the main advantage of this book - the ease of assimilation of the material . A large number of illustrations is an additional plus. In my opinion, every picture in the book has its place: they all allow you to reinforce the words of the authors and gain a deeper understanding of the essence of the material. As I wrote above, this book is not a reference book: its authors do not intend to list all the patterns. Its main task is to provide understanding and talk about the basic patterns so that other, more complex ones, are easier to understand. And she copes with this 100%. Among the disadvantages is that Head first design patterns in Russian are not as easy to read as in English. Of course, every developer should speak English, but novice programmers do not always develop this skill to such an extent that they can read books in the original. However, this can be considered a forced minus, since the material is presented quite accurately and the meaning is preserved.Additional books on design patterns
I am a proponent 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.-
Object-oriented design techniques. Design Patterns (Gamma E., Helm R., Johnson R., Vlissides J.).
This is a more serious publication, a reference book of patterns, a very respected book from the “Gang of Four”. Many call it the bible of OO design.
On the Internet, the opinions of developers are divided into 3 camps:
- some argue that the book is outdated and the style of presentation makes it impossible to read
- others recommend using the book solely as a reference book on patterns, nothing more
- still others say that 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
Important:The examples in the book are written in C++.
-
Java EE. Design patterns for professionals (Murat Yener, Alex Fidom).
This book is dedicated to the design of Enterprise applications: it covers many examples of real-life application problems.
-
Design patterns in Java (Grand M.).
The book colorfully demonstrates how the use of patterns saves developers time, provides an overview of the UML language, and describes 47 design patterns.
Design Patterns in JavaRush
In the JavaRush course, design patterns are learned 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 yourself”:-
A general article on the topic of patterns with categories, examples, everything we like.
-
Two articles on patterns: part 1 overview and more detailed part 2 .
-
Design patterns using the Singleton pattern as an example .
-
The concept of design patterns is related to UML diagrams, this article will help you understand what they are.
GO TO FULL VERSION