Object-Oriented Programming (OOP)
Object-oriented programming (OOP) describes a programming paradigm in which data and functions that operate on - or are in any way associated with - that data are bundled into so called classes, while instantiations of these classes are referred to as objects. Functions of classes are usually called methods and any data variables that are marked as private are called members.
The four foundations of OOP traditionally are
- Abstraction
- Encapsulation
- Polymorphism
- Inheritance
Principles
The SOLID Principles:
- Single-Responsibility Principle: A class should have only one reason to change.
- Open-Closed Principle: Classes should be open for extension but closed for modification.
- Liskov substitution principle.
- Interface segregation: Program to interfaces, not implementations.
- Dependency Inversion Principle: Depend on abstractions. Do not depend on concrete classes.
Other principles:
- Encapsulate what varies.
- Favor composition over inheritance.
- Strive for loosely coupled designs between objects that interact.