CHARISTOPHER ALEXANDER Says that each pattern describes a problem which occurs over and over again in our environment and that describes the core of the solution to that problem in such a way that you can use these solutions a million times without ever doing it.A design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
Uses of design pattern:
- Design patterns are the best solution for the recording problem in the application programming environment.
- It is responsible for design pattern analysis in another arms including GUI (graphical user interface)
- It is mainly used in object oriented programming
Design pattern elements:
In general a pattern has four essential elements they are
PATTERN NAME: The pattern name is a handle we can use to describe a design problem, its solutions, and consequences in a word or two. Naming a pattern immediately increases our design vocabulary. It lets us design at a higher level of abstraction. Having a vocabulary for patterns lets us talk about them with our colleagues, in our documentation, and even to ourselves. It makes it easier to think about designs and to communicate them and their trade-offs to others. Finding good names has been one of the hardest parts of developing our catalog.
PROBLEMS: The problem describes when to apply the pattern. It explains the problem and its context. It might describe specific design problems such as how to represent algorithms as objects. It might describe class or object structures that are symptomatic of an inflexible design. Sometimes the problem will include a list of conditions that must be met before it makes sense to apply the pattern.
SOLUTIONS:The solution describes the elements that make of the design there relationships responsibilities and collaborations.
CONSEQUENCES: The consequences are the result and trade of applying the pattern The consequence of a pattern includes its impact on a system i.e;Every problem will be having some consequences
1.ABSTRACT FACTORY:
Provides an interface for creating families of related or dependent objects without specifying their concrete classes
2.Adapter:
Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
3.Bridge:
Decouple (separate) the abstraction from its implementation so that the two can vary independently.
4.Builder:Separate (hide) the construction process from its representation so that the same construction process can create different representations.
5.Chain of Responsibility:
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
6.Command:
Encapsulate a request as an object which allows us to parametrize the clients with different requests and support undoable operations.
7.Composite:
Combine objects into tree structures to form part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
8.Decorator:
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub classing for extending functionality.
9.Facade:
Provide a uniform interface for a set of interfaces in a subsystem. Facade defines a higher level interface to make the subsystem easier to use.
10.Factory Method:
Defines an interface to create an object, but lets subclasses decide which class to instantiate. Factory Method lets a class differ instantiation to subclasses.
11.Flyweight:
Use sharing to support large numbers of fine-grained objects efficiently.
12.Interpreter:
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
13.Iterator:
Provides a way to access the individual elements of an aggregate object without exposing its underlying representation.
14.Mediator:
Define an object that encapsulates how a set of objects interact.
15.Memento:
Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.
16.Observer:
Defines a one-to-many dependency between objects so that if one object changes its state, it will notify the change to all other objects and update automatically.
17.Prototype:
Specifies the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
18.Proxy:
Provide a placeholder for another object to control access to it.
19.Singleton:
Ensure a class has only one object and a global point of access to that object.
20.State:
Allow an object to change its behavior when its internal state changes. The object will appear to change its class.
21.Strategy:
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
22.Template Method:
Define the skeleton of an algorithm in an operation, deferring some steps to sub classes.
23.Visitor:
Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.
Design Pattern name and classification: The pattern name specifies the essence of the pattern precisely. A good name is a key as it will become a part of our design vocabulary. Classification specifies the type of pattern.
Intent: A short statement that tells us what the pattern does and which design issue or problem the pattern addresses.
Other well known names for the pattern, if any.
Motivation:
A scenario that illustrates a design problem and how the class and object structures solve that problem. The scenario will help us understand the abstract pattern definition.
Applicability:
This specifies in which situations a design pattern can be applied. What are the examples of poor designs that the pattern can address? How to recognize these situations?
Structure:
A graphical representation of the classes involved in the pattern following the notations of Object Modeling Technique (OMT). We also use interaction diagrams to illustrate sequences of the requests and the collaborations between objects.
Participants:
The classes and / or objects participating in the pattern and their responsibilities.
Collaborations:
How the classes and objects collaborate to carry out their responsibilities.
Consequences:
Tells us what are the costs and benefits of using the pattern. Also tells us which part of the system can be changed independently.
Implementation:
Specifies what techniques we should be aware of when implementing the pattern and also tells us if there are any language specific issues.
Sample code:
Code fragments that tell us how to implement the pattern in java.
Known uses: Example usage of the patterns in the real world.
Related patterns: Specifies which other patterns are related to this pattern and what are the differences between them.
Useful Files
Users Joined
Warning: Undefined variable $getUser in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Trying to access array offset on value of type null in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Undefined variable $getUser in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Trying to access array offset on value of type null in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Undefined variable $getUser in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Trying to access array offset on value of type null in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Undefined variable $getUser in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Trying to access array offset on value of type null in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Undefined variable $getUser in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56
Warning: Trying to access array offset on value of type null in /home/wolf.engineershub.in/public_html/engineershub/engineershub/themes/ehthree/layout/right-sidebar.phtml on line 56