SOLID (object-oriented design)
What is the The Single-Responsibility Principle?
A class should have only one reason to change.
A Kludge is not
An Winter Olympic sport. :)
Strategy Design Pattern....
Captures the abstraction in an interface, and buries implementation details in derived classes.
Interface Segregation Principle states that ...
Clients should not be forced to depend on methods they do not use
The Single-Responsibility Principle (SRP) is also called?
Cohesion.
If a class has more than one responsibility, the responsibilities become?
Coupled
Template Method
Define the skeleton of an algorithm in an operation, deferring some steps to subclasses while others in the abstract base class.
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 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
String coupling leads to?
Fragile designs that break in unexpected ways when changed
What is cohesion?
How strongly-related and focused are the various responsibilities of a module
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 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.
Strive for?
Low coupling and high cohesion
The O Stands For?
Open/closed principle "software entities ... should be open for extension, but closed for modification".
What is as important as abstraction itself?
Resisting premature abstraction.
Who came up with SOLID?
Robert C. Martin
What two patterns are the most commons ways to satisfy the open closed principle?
STRATEGY pattern and the TEMPLATE METHOD pattern
The S Stands For?
Single responsibility principle
What is coupling?
The degree to which each program module relies on each one of the other modules
The Single-Responsibility Principle (SRP) was created by?
Tom DeMarco and Meilir Page-Jones
When do you use the factory pattern?
When you want to choose a class that inherits from the same base class at runtime.