This repository contains php code based in the book Head First Design Patterns
I recommend to see each commit, For every commit I explain what I'm doing and you can see how was changed the code
I'm working with the next design patterns:
-
Strategy pattern
-
Observer pattern
-
Decorator pattern
-
Factories
- Simple factory (It is not considered officially a design pattern)
- Factory method pattern
- Abstract factory pattern
-
Singleton pattern(a few code, explains how deal with multithreading, and another things)
-
Command pattern
-
Adapter pattern
-
Facade pattern
-
Template method pattern
-
Iterator pattern
- Due to the little quantity of code I wanna add a little explanation.
That pattern helps to encapsulate the type of collection to the client: array, hashmap, linkedlist, etc), We work with classes than implement a Iterator interface, hence if we change our internals the client still work with an Iterator.
-
Composite pattern
-
State pattern
-
Proxy pattern
- The code is extremely coupled to Java, because of this I didn't add nothing. If you wanna more info check this: Proxy pattern
If you have several years of experience working in companies and many times you felt that your code or the code of your company is prone to be a "troublemaker", then I recommend you to buy that book
I think that for take advantage of this book you require experience in many real projects, had been struggle with real problems. In that book you will see THAT problems (also in Refactorings book)
If you don't have experience working in "real" projects I recommend to you to wait to work with them before of buy that book.
I hope this repository helps you in some way.