OO Principles Flashcards
Interfaces
Code to an interface rather than to an implementation.
Changing a class
Each class in your application should have only one reason to change.
What are classes all about anyway?
Classes are about behavior and functionality.
The Open-Closed Principle
Classes should be open for extension, but closed for modification (OCP).
The DRY principle
Avoid duplicate code by abstracting out things that are common and placing them in a single location.
The SRP
Every object in your system should have a single responsibility, and all the object’s services should be focused on carrying out that single responsibility.
The LSP
Subclasses should be suitable for their base classes.
Encapsulation
Encapsulate what varies.