You are on page 1of 12

STRUCTURAL DESIGN PATTERNS

Presented by PRASHANTH HS

STRUCTURAL DESIGN PATTERN


Structural design patterns can be used to organize your program into groups. This segregation will provide you clarity and will enable you for easier maintainability.

TYPES OF STRUCTURAL DESIGN PATTRENS


1) FCADE PATTERN
2) BRIDGE PATTERN 3) DECORATOR PATTERN

4) ADAPTER PATTERN

FCADE PATTERN
FCADE pattern provide a unified interface to a set of interfaces in a subsystem. Facade Pattern defines a higher-level interface that makes the subsystem easier to use.

EXAMPLE OF FCADE PATTERN

In the above design Mercides factory creates family car and sports cars and audi factory also creates both family and sports cars. Car factory has family car and sports cars of both factory. Driver drives family car and sports cars of audi factory and mercedes factory. Thus creates unified interface b/w family car and sports car classes .this is refferd as FCADE design pattern.

BRIDGE PATTERN
Decouple an abstraction from its implementation so that the two can vary independently is the intent for bridge design pattern. Bridge design pattern is a modified version of the notion of prefer composition over inheritance. It creates two different hierarchies. One for abstraction and another for implementation.

EXAMPLE OF BRIDGE PATTERN

Workshop can manufacture bike and also car but it violates fundamental principle of objects:an object should responsible for itself.workshop should know specific information about vehcle (i.e type of vehcle)in order to manufacture them.shapes wouldnt need to know what type of workshop object used because I could have vehcles refer to the workshop class. In the above design vehcle uses workshop to manifest its bahavior.

DECORATOR PATTERN
To extend or modify the behaviour of an instance at runtime design pattern is used. Inheritance is used to extend the abilities of a class. Unlike inheritance, you can choose any single object of a class and modify its behaviour leaving the other instances unmodified.

EXAMPLE OF DECORATOR PATTERN

In the above design SAMPLE ICECREAM is the concrete component. HONEY DECORATOR adds honey and NUTTY DECORATOR adds honey. Both are used with ICECREAM . Then ICECREAM is prepared with adding required amount of honey and nutts. This is reffered as DEECORATOR PATTERN.

ADAPTER PATTERN
An adapter helps two incompatible interfaces to work together. Adapter design pattern is used when you want two different classes with incompatible interfaces to work together. The name says it all. Interfaces may be incompatible but the inner functionality should suit the need.

EXAMPLE OF ADAPTER PATTERN

player is used to play audio and video songs. The windows media plays .mp4, .mp3 files but not play .vob, .flv . To play these types of files we adopt the vlc media player.

Thank You..

You might also like