Object-oriented Basics, Principles and Patterns
In writing...
A place to bookmark Object-oriented basics, principles and patterns. Kind of like an index.
Object-oriented Basics
- Abstraction
- Encapsulation
- Polymorphism
- Inheritance
Object-oriented Principles
- Encapsulate what varies
- Favour composition over inheritance
- Program to interfaces, not to implementations
Object-oriented Patterns
- 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).