SOLID (object-oriented design)
Terms in this set (22)
Who came up with SOLID?
Robert C. Martin
The S Stands For?
Single responsibility principle
The O Stands For?
Open/closed principle "software entities ... should be open for extension, but closed for modification".
The L Stands For?
Liskov substitution principle "objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program". See also design by contract.
The I Stands For?
Interface segregation principle "many client-specific interfaces are better than one general-purpose interface. In other words no client class should be forced to depend on methods it does not use.
The D Stands For?
Dependency inversion principle. One should "Depend upon Abstractions. Do not depend upon concretions."
High-level modules should not depend on low-level modules. Both should depend on abstractions.
What is cohesion?
How strongly-related and focused are the various responsibilities of a module
What is coupling?
The degree to which each program module relies on each one of the other modules
Low coupling and high cohesion
What is the The Single-Responsibility Principle?
A class should have only one reason to change.
The Single-Responsibility Principle (SRP) is also called?
The Single-Responsibility Principle (SRP) was created by?
Tom DeMarco and Meilir Page-Jones
If a class has more than one responsibility, the responsibilities become?
String coupling leads to?
Fragile designs that break in unexpected ways when changed
A Kludge is not
An Winter Olympic sport. :)
What two patterns are the most commons ways to satisfy the open closed principle?
STRATEGY pattern and the TEMPLATE METHOD pattern
Strategy Design Pattern....
Captures the abstraction in an interface, and buries implementation details in derived classes.
What is as important as abstraction itself?
Resisting premature abstraction.
Interface Segregation Principle states that ...
Clients should not be forced to depend on methods they do not use
Define the skeleton of an algorithm in an operation, deferring some steps to subclasses while others in the abstract base class.
When do you use the factory pattern?
When you want to choose a class that inherits from the same base class at runtime.
What 3 approaches can you can take to move the responsibility for instantiating and managing objects on behalf of other client objects
Factories, Service Locators, and Dependency Injectio