Object-oriented Basics, Principles and Patterns
A place to bookmark Object-oriented basics, principles and patterns. Kind of like an index.
- Encapsulate what varies
- Favour composition over inheritance
- Program to interfaces, not to implementations
- Strategy - defines a family of algorithms (duck quacks, different Zelda items), encapsulates each one (into individual classes), and makes them interchangeable (compose them with another class - add the interface as an instance variable that can be swapped out).