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:- visibility
- Conversational style of presentation
- A large number of illustrations
- Active participation of the reader
- Appeal to emotions
- Capturing 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. 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.”"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 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 :- Observer. Propagates events to objects that are interested in their occurrence.
- Decorator. Another look at inheritance in Java and empowering Java classes with new features 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, extending the possibilities.
- Adapter and Facade. Solving the problem of interface incompatibility, as well as packaging objects to simplify their interface.
- template method. Encapsulation of algorithm blocks, allowing subclasses to be associated with the desired processing algorithm at any time.
- 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.
- State. Objects are endowed with the ability to control their behavior through changes in internal state.
- Deputy. A very handy pattern for controlling access to an object.
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.-
Techniques of object-oriented design. Design patterns (E. Gamma, R. Helm, R. Johnson, J. Vlissides).
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
Important:the examples in the book are written in C++.
-
Java EE. Design Patterns for Professionals (Murat Yener, Alex Fidom).
This book is all about enterprise application design, with many examples of real world 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, 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”:-
A general article on the topic of patterns with categories, examples, everything we love.
-
Two articles on patterns: part 1 overview and more detailed part 2 .
-
Design patterns on the example of the Singleton pattern .
-
The concept of design patterns is associated with UML diagrams, this article will help you understand what it is.
GO TO FULL VERSION