Object-Oriented Principles Flashcards
SOLID Principles?
Single-Responsibility Principle Open Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle
Single-Responsibility Principle?
A class should have one, and only one reason to change
SoC principle that focuses on managing change by assigning cohesive responsibilities.
Open-Closed Principle
You should be able to extend the behaviour of a module without modifying it
A module is closed for modification but open to be extended.
How is Open-Closed Principle achieved?
Loose coupling
Abstraction
Polymorphism
Liskov Substitution Principle?
Subclasses should be substitutable for their base classes
Dictates the correct implementation of the IS-A relationship
Interface Segregation Principle?
Many client specific interfaces are better than one general purpose interface
Critical principle to follow in the design of interfaces who are much more focused than the classes that implement them
Dependency Inversion Principle?
Depend upon Abstractions. Do not depend upon concretions
Definition of use of abstraction to ensure loose coupling.
Enables dependency injections and associated frameworks
S O L I D
High Cohesiveness Code Reuse Code Reuse SoC Loose Coupling
4 Essential elements in Design Pattern?
Pattern Name
Problem
Solution
Consequencies
What did GoF do?
GoF established a paradigm for cataloguing and reuse of design solutions
Pattern Catagorization?
Architecture Patterns
Design Patterns
Idioms
Architectural Patterns?
Expresses fundamental structural organizartion of software systems; predefined subsystems and their responsibilities and relationships
* Large Scale Patterns
Design Patterns?
Medium Scale Patterns
Idioms?
Programming language specific pattern that describes how to implement particular aspects of components, relationships or functionality
Pattern Classification By Purpose list
Creational Patterns
Structural Patterns
Behavioural Patterns