Design Patterns encapsulate together ways of problem solving and language features; It codify general solution to common problems.
Some are born programmers but not all. It is often seen that even best programmers sit for hours or even days over single screen of code, in finding out ways to make it even better. Design patterns help programmers to write flexible, maintainable, reliable and reusable code.
There are 23 design patterns divided into three groups: Structural, Creational and Behavioral.
A. Structural Pattern – These are concerned with how classes and objects are composed to form larger structure. Following design patterns are grouped into Structural Design Pattern-
1. Decorator – Example of use: Adding new functionality dynamically to existing objects, or remove it.
2. Proxy – Example of use: Control access to an object. Create expensive objects on demand.
3. Bridge – Example of use: Enable development of the interface and implementation of a component to proceed independently. Select or switch implementation at runtime.
4. Composite – Example of use: Treat single objects and composite objects in same way.
5. Flyweight – Example of use: Reduce the cost of working with large number of very small objects.
6. Adapter – Example of use: Match otherwise incompatible interfaces.
7. Facade – Example of use: Simplify the interface to a complex subsystem. Reorganize a system with many subsystems into identifiable layers with single entry points.