devcorpio/design_patterns


This repository contains php code based in the book Head First Design Patterns

  • Users starred: 5
  • Users forked: 0
  • Users watching: 5
  • Updated at: 2018-04-15 04:17:47

design_patterns

This repository contains php code based in the book Head First Design Patterns

Important

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:

  1. Strategy pattern

  2. Observer pattern

  3. Decorator pattern

  4. Factories

    • Simple factory (It is not considered officially a design pattern)
    • Factory method pattern
    • Abstract factory pattern
  5. Singleton pattern(a few code, explains how deal with multithreading, and another things)

  6. Command pattern

  7. Adapter pattern

  8. Facade pattern

  9. Template method pattern

  10. 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.

  11. Composite pattern

  12. State pattern

  13. 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

conclusions

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.