Final Flashcards
used when we need to decouple an abstraction from its implementation so that the two can vary independently. This type of design pattern comes under structural pattern as this pattern decouples implementation class and abstract class by providing a bridge structure between them.
Bridge
This pattern involves an interface which acts as a connection which makes the functionality of concrete classes independent from interface implementer classes. Both types of classes can be altered structurally without affecting each other.
Bridge
behavioral software design pattern that implements a machine in an object -oriented way . is implemented by implementing each individual as a derived class of the interface , and implementing transitions by invoking methods defined by the pattern’s superclass
State design pattern
can be interpreted as a strategy pattern which is able to switch the current strategy through invocations of methods defined in the pattern’s interface.
state pattern
This pattern is used in computer programming to encapsulate varying behavior for the same object based on its internal state. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements and thus improve maintainability
State design pattern
is the degree of interdependence between software modules; a measure of how closely connected two routines or modules are; the strength of the relationships between modules.
coupling
refers to the degree to which the elements of a module belong together. measures the strength of relationship between pieces of functionality within a given module.
Cohesion
All good software design will go for HIGH __________ and LOW _________
cohesion
coupling
We must have:
We want good:
Coupling
Coupling
is used to describe just how much an outside class can get into another class’s members:
is used to describe just how much access an outside class has to another class with a well designed API:
Tight Coupling
Loose coupling
is a principle of software development, aimed at reducing repetition of information of all kinds, especially useful in multi-tier architectures.
DRY
Principles of object oriented design: SOLID
(SRP) Single responsibility principle
(OCP) Open Close Principle
(LSP) Liskov substitution principle
(ISP) Interface Segregation principle
(DIP) Dependency Inversion principle
says “Every software module should have only one reason to change” Software Module Class, Function etc. Reason to change Responsibility
Single responsibility principle SRP
says, “Software modules should be closed for modifications but open for extensions.”
Open close principle OCP
says, “Subclasses should be substitutable for base classes.”
Liskov substitution principle LSP
states that if a program module is using a Base class, then the reference to the Base class can be replaced with a Derived class without affecting the functionality of the program module .
Likov’s Substitution Principle
states that a client should never be forced to implement an interface that it doesn’t use or clients shouldn’t be forced to depend on methods they do not use.
Interface segregation principle ISP
says, “High level modules should not depend upon low level modules . Rather , both should depend upon abstractions .”
Dependency inversion principle DIP
Entities must depend on abstractions not on concretions. It states that the high level module must not depend on the low level module, but they should depend on abstractions.
Dependency inversion principle DIP
Who are the Gang of Four (GOF)
Erich Gamma
Richard Helm
Ralph Johnson
John Vlissides
Elements of Reusable Object -Oriented
Design Patterns