Design Patterns Made Easy - A Review of Head First Design Patterns Head first

Last updated Feb 3, 2024 Published Feb 20, 2015

The content here is under the Attribution 4.0 International (CC BY 4.0) license

You can find the source code in the already but also you can have a look at the github and learn a bit more about the book content. If you want to order a copy for you go ahead and visit O Reilly website.

Welcome to Design Patterns

The section “Welcome to Design Patterns” is a quick review through the object oriented programming and of course the paradigm  inheritance X composition. Although in the end you will learn your first pattern the Strategy!

Keeping your Objects in the know

Moving on the next pattern is the Observer. And in this step of the book the author starts to give us how the patterns are applied to the real word with Java (using the java.util.Observable, but if you are looking for something in PHP you’ll find the SplObserver).

Decorating Objects

Now we were introduced to the Design Patterns in the real world with java the next pattern is the Decorator. You can find the Decorator in the java as well in the package java.io.

Baking with OO Goodness

Do you like pizza? If yes, this is your pattern! The Factory Method Pattern come along with some pizzas store and the Dependency Inversion Principle as well.

One of a Kind Objects

Can you guess what is this pattern about? If we are talking about just one kind of object we are talking about Singleton Pattern.

Encapsulating Invocation

Command Pattern !

Being Adaptive

The Adapter Patter is presented with a good example of wall outlet from Europe and how to adapt this to another standards such as the wall outlet from America. But this section is not about just one pattern in Being Adaptive the book bring to us the Facade Pattern as well, with a great analogy  of watching a movie at home.

Encapsulating Algorithms

Encapsulating Algorithms is all about the Template Method and how you can use it to encapsulate your algorithms

Well-Managed Collections

Now we have a lot of knowledge in design patterns is time to focus on collections in java such as ArrayList, Iterator Pattern and Composite Pattern! But again, if you are looking for something similar in PHP visit the SPL page.

The State of Things

Have you ever wondering about ifs and elses? This section of the book explain to us a better way, the state pattern. From now on you will not using loads of if and else in your code to prove it the example used was a gumball machine and its states.

Controlling Object Access

We are getting to the end of the book, but first the design of this time is about security and controlling access. In our lives we present this every day in a coffee shop with our credit cards or in our work place with our credentials and in our code there is no difference and we will look at the Proxy Pattern.

Patterns of Patterns

Patterns of Patterns is much more about patterns working together instead of learning a new pattern. Often in our daily routine as programmers we combine a lot of knowledge to make a single solution.

In Patterns of Patterns is the same thing we will see how to use patterns together rather than learn through them. Except for one single pattern called MVC (Model-View-Controller) you will see the MVC in details and build a great application with it.

Patterns in the Real World

Finally we have got the end! The Patterns in the Real World is about what a patter is in fact and how it can help us to create great solutions to the client with a good code quality and maintenance.

The gang of four [1] is mentioned by the author as a reference in patterns you must check it out.

References

  1. [1]E. Gamma, R. Helm, R. Johnson, R. E. Johnson, J. Vlissides, and others, Design patterns: elements of reusable object-oriented software. Pearson Deutschland GmbH, 1995.

Changelog

Changelog

  • Feb 02, 2024 - Added “O’Reilly design patterns bootcamp” under resources - this was a live event recorded with the authors of the book