OOP Flashcards
Abstraction
Abstraction is a model of a real-world object or phenomenon,
limited to a specific context, which represents all details relevant to this context with high accuracy and omits all the rest.
Encapsulation
Encapsulation is the ability of an object to hide parts of its state and behaviors from other objects, exposing only a limited interface to the rest of the program.
Inheritance
Inheritance is the ability to build new classes on top of existing ones. The main benefit of inheritance is code reuse.
Polymorphism
Polymorphism is the ability of a program to detect the real class of an object and call its implementation even when its real type is unknown in the current context.
Solid - S
Single Responsibility Principle A class should have just one reason to change.
Solid - O
Open/Closed Principle
Classes should be open for extension but closed for
modification.
Solid - L
Liskov Substitution Principle When extending a class, remember that you should be able to pass objects of the subclass in place of objects of the parent class without breaking the client code.
Solid - I
Interface Segregation Principle
Clients shouldn’t be forced to depend on methods they
do not use.
Solid - D
Dependency Inversion Principle
High-level classes shouldn’t depend on low-level classes. Both should depend on abstractions. Abstractions shouldn’t depend on details. Details should depend on abstractions.