Design patterns for Go.
Patters have Summary
, Example
and Benefit
section present as comments. The focus is to bring out the benefit of the pattern with a simple real world example.
- Creational: Concerns with the process of object creation.
- Structural: Deals with composition of objects.
- Behavioural: Ways in which objects interact and distribute responsibility.
- Strategy
- Template Method
- Chain Of Responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Interpretor
- Iterator
- Walker
make test
Feel free to create issues and pull requests to make it better and clearer for the reader.
Previous work on this subject which helped in making this:
- Design Patterns by Gangs of Four(GOF) is a book on this.
- Go Patterns by bvwells have a lot of good simple examples.
- Refactoring Guru and GolanyByExample also have a lot of examples.
- Builder Pattern Series by Surya Reddy demostrate various styles on this pattern.
- Fluent and Classic builder pattern separates the builder pattern into two types, internet is filled with confusing articles on it. There are actually 2 different builder patterns.
- Prototype Pattern by Surya Reddy
- DudeWhoCodes uses Adapater Pattern