SlideShare a Scribd company logo
Structural PatternStructural Pattern
Dr. Himanshu Hora
SRMS College of Engineering & Technology
Bareilly (UP) INDIA
Dr. Himanshu Hora
SRMS College of Engineering & Technology
Bareilly (UP) INDIA
01/16/16
Structural Pattern
1
ContentContent
• History of Design Pattern
• Definitions of Design Pattern
• Types of Pattern
• Adapter
• Bridge
• Composite
• Decorator
• Facade
• Flyweight
• Proxy
• Benefits and Possible problems
• History of Design Pattern
• Definitions of Design Pattern
• Types of Pattern
• Adapter
• Bridge
• Composite
• Decorator
• Facade
• Flyweight
• Proxy
• Benefits and Possible problems
01/16/16 Structural Pattern 2
History of Design PatternHistory of Design Pattern
• In 1994, Design Patterns: Elements of Reusable Object-
Oriented Software by Erich Gamma, Richard Helm, Ralph
Johnson and John Vlissides explained the usefulness of
patterns and resulted in the widespread popularity of design
patterns.
• These four authors together are referred to as the Gang of Four
(GoF).
• In 1994, Design Patterns: Elements of Reusable Object-
Oriented Software by Erich Gamma, Richard Helm, Ralph
Johnson and John Vlissides explained the usefulness of
patterns and resulted in the widespread popularity of design
patterns.
• These four authors together are referred to as the Gang of Four
(GoF).
01/16/16 Structural Pattern 3
Definitions of Design PatternDefinitions of Design Pattern
• Design patterns are recurring solutions to software design
problems you find again and again in real-world application
development
OR
• Design patterns represent solutions to problems that arise
when developing software within a particular context
OR
• Design patterns are standard solutions to common problems in
software design
• Design patterns are recurring solutions to software design
problems you find again and again in real-world application
development
OR
• Design patterns represent solutions to problems that arise
when developing software within a particular context
OR
• Design patterns are standard solutions to common problems in
software design
01/16/16 Structural Pattern 4
Types of PatternTypes of Pattern
There are 3 types of pattern
• Creational: address problems of creating an object in a
flexible way. Separate creation, from operation/use.
• Structural: address problems of using O-O constructs like
inheritance to organize classes and objects
• Behavioral: address problems of assigning responsibilities to
classes. Suggest both static relationships and patterns of
communication (use cases)
There are 3 types of pattern
• Creational: address problems of creating an object in a
flexible way. Separate creation, from operation/use.
• Structural: address problems of using O-O constructs like
inheritance to organize classes and objects
• Behavioral: address problems of assigning responsibilities to
classes. Suggest both static relationships and patterns of
communication (use cases)
01/16/16 Structural Pattern 5
Types of PatternTypes of Pattern
Creational Patterns
(concerned with abstracting the object-instantiation process)
• Factory Method Abstract Factory Singleton
• Builder Prototype
Structural Patterns
(concerned with how objects/classes can be combined to form larger
structures)
• Adapter Bridge Composite
• Decorator Facade Flyweight
• Proxy
Behavioral Patterns
(concerned with communication between objects)
• Command Interpreter Iterator
• Mediator Observer State
• Strategy Chain of Responsibility Visitor
• Template Method
Creational Patterns
(concerned with abstracting the object-instantiation process)
• Factory Method Abstract Factory Singleton
• Builder Prototype
Structural Patterns
(concerned with how objects/classes can be combined to form larger
structures)
• Adapter Bridge Composite
• Decorator Facade Flyweight
• Proxy
Behavioral Patterns
(concerned with communication between objects)
• Command Interpreter Iterator
• Mediator Observer State
• Strategy Chain of Responsibility Visitor
• Template Method
01/16/16 Structural Pattern 6
AdapterAdapter
• Convert the interface of a class into another interface clients
expect
• Adapter lets classes work together that couldn't otherwise
because of incompatible interfaces
• Use the Adapter pattern when:
– you want to use an existing class and its interface does not
match the one you need
– you need to use several existing subclasses, but it's
impractical to adapt their interface by subclassing
everyone. An object adapter can adapt the interface of its
parent class
• Convert the interface of a class into another interface clients
expect
• Adapter lets classes work together that couldn't otherwise
because of incompatible interfaces
• Use the Adapter pattern when:
– you want to use an existing class and its interface does not
match the one you need
– you need to use several existing subclasses, but it's
impractical to adapt their interface by subclassing
everyone. An object adapter can adapt the interface of its
parent class
01/16/16 Structural Pattern 7
AdapterAdapter
01/16/16 Structural Pattern 8
BridgeBridge
• Decouple an abstraction from its implementation so that the
two can vary independently
• Use the Bridge pattern when:
– you want run-time binding of the implementation
– you want to share an implementation among multiple
objects
• Decouple an abstraction from its implementation so that the
two can vary independently
• Use the Bridge pattern when:
– you want run-time binding of the implementation
– you want to share an implementation among multiple
objects
01/16/16 Structural Pattern 9
BridgeBridge
01/16/16 Structural Pattern 10
CompositeComposite
• Compose objects into tree structures to represent whole-part
hierarchies. Composite lets clients treat individual objects and
compositions of objects uniformly
• Use this pattern whenever you have "composites that contain
components, each of which could be a composite".
• Compose objects into tree structures to represent whole-part
hierarchies. Composite lets clients treat individual objects and
compositions of objects uniformly
• Use this pattern whenever you have "composites that contain
components, each of which could be a composite".
01/16/16 Structural Pattern 11
CompositeComposite
01/16/16 Structural Pattern 12
DecoratorDecorator
• Attach additional responsibilities to an object dynamically
• Decorators provide a flexible alternative to subclassing for
extending functionality
• Attach additional responsibilities to an object dynamically
• Decorators provide a flexible alternative to subclassing for
extending functionality
01/16/16 Structural Pattern 13
ProblemsProblems
• Several classes with a similar operation (method), but
different behavior.
• We want to use many combinations of these behaviors
• Several classes with a similar operation (method), but
different behavior.
• We want to use many combinations of these behaviors
01/16/16 Structural Pattern 14
Example - Automated HospitalExample - Automated Hospital
• People come to the reception with problems
• They describe their problems
• A special doctoRobot is created that is specialized to treat
their special situations.
• People come to the reception with problems
• They describe their problems
• A special doctoRobot is created that is specialized to treat
their special situations.
01/16/16 Structural Pattern 15
Automated Hospital - Solution 1Automated Hospital - Solution 1
DoctoRobot
Cure (p : Patient)
DentistRobot
Cure (p : Patient)
DermaRobot
Cure (p : Patient)
PsychoRobot
Cure (p : Patient)
DentistDermaRobot DentistPsychoRobot DermaPsychoRobot
01/16/16 Structural Pattern 16
Problems with solution-1Problems with solution-1
• Sometimes we don’t have multiple inheritance.
• Even if we have, if is problematic, and bad design.
• Sometimes we don’t have multiple inheritance.
• Even if we have, if is problematic, and bad design.
01/16/16 Structural Pattern 17
A Better idea: Use DecoratorA Better idea: Use Decorator
ConcreteComponent
Operation( )
ConcreteDecoratorA
addedState
Operation( )
ConcreteDecoratorB
Operation( )
Decorator
Operation( )
Component
Operation( )
component
01/16/16 Structural Pattern 18
Decorator in our caseDecorator in our case
DentistRobot
Cure (p : Patient)
DermaRobot
Cure (p : Patient)
PhsychoRobot
Cure (p : Patient)
DoctorRobotDecorator
innerDoctor
Cure (p : Patient)
DoctoRobot
Cure (p : Patient)
component
01/16/16 Structural Pattern 19
FacadeFacade
• Provide a unified interface to a set of interfaces in a subsystem
• Facade defines a higher-level interface that makes the
subsystem easier to use
• Create a class that is the interface to the subsystem
• Clients interface with the Facade class to deal with the
subsystem
• It hides the implementation of the subsystem from clients
• It promotes weak coupling between the subsystems and its
clients
• It does not prevent clients from using subsystems class, should
it?
• Provide a unified interface to a set of interfaces in a subsystem
• Facade defines a higher-level interface that makes the
subsystem easier to use
• Create a class that is the interface to the subsystem
• Clients interface with the Facade class to deal with the
subsystem
• It hides the implementation of the subsystem from clients
• It promotes weak coupling between the subsystems and its
clients
• It does not prevent clients from using subsystems class, should
it?
01/16/16 Structural Pattern 20
FacadeFacade
01/16/16 Structural Pattern 21
FlyweightFlyweight
• Use sharing to support large numbers of fine-grained objects
efficiently
• The pattern can be used when:
– The program uses a large number of objects and
– The program does not use object identity (==)
• Use sharing to support large numbers of fine-grained objects
efficiently
• The pattern can be used when:
– The program uses a large number of objects and
– The program does not use object identity (==)
01/16/16 Structural Pattern 22
FlyweightFlyweight
01/16/16 Structural Pattern 23
ProxyProxy
• Provide a surrogate or placeholder for another object to
control access to it.
• The proxy has the same interface as the original object
• Virtual Proxy:
– Creates/accesses expensive objects on demand
– You may wish to delay creating an expensive object until it
is really accessed
– It may be too expensive to keep entire state of the object in
memory at one time
• Provide a surrogate or placeholder for another object to
control access to it.
• The proxy has the same interface as the original object
• Virtual Proxy:
– Creates/accesses expensive objects on demand
– You may wish to delay creating an expensive object until it
is really accessed
– It may be too expensive to keep entire state of the object in
memory at one time
01/16/16 Structural Pattern 24
• Protection Proxy
– Provides different objects different level of access to
original object
• Cache Proxy (Server Proxy)
– Multiple local clients can share results from expensive
operations: remote accesses or long computations
• Firewall Proxy
– Protect local clients from outside world
• Protection Proxy
– Provides different objects different level of access to
original object
• Cache Proxy (Server Proxy)
– Multiple local clients can share results from expensive
operations: remote accesses or long computations
• Firewall Proxy
– Protect local clients from outside world
01/16/16 Structural Pattern 25
ProxyProxy
01/16/16 Structural Pattern 26
Benefits
• Flexible
• Don’t have to foresee all combinations
• Little objects
Possible problems
• Performance
• Decorators are not necessarily always cummutative
(surgeon and Anastasiolic)
01/16/16 Structural Pattern 27
Thank You
01/16/16 Structural Pattern 28
Dr. Himanshu Hora
SRMS College of Engineering & Technology
Bareilly (UP) INDIA
Dr. Himanshu Hora
SRMS College of Engineering & Technology
Bareilly (UP) INDIA
Ad

More Related Content

What's hot (20)

PATTERNS04 - Structural Design Patterns
PATTERNS04 - Structural Design PatternsPATTERNS04 - Structural Design Patterns
PATTERNS04 - Structural Design Patterns
Michael Heron
 
Design patterns creational patterns
Design patterns creational patternsDesign patterns creational patterns
Design patterns creational patterns
Malik Sajid
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
ASHOK KUMAR PALAKI
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
artgreen
 
OOAD
OOADOOAD
OOAD
yndaravind
 
Class diagrams
Class diagramsClass diagrams
Class diagrams
Nadia_Nazeer
 
Domain class model
Domain class modelDomain class model
Domain class model
shekharsj
 
Adapter pattern
Adapter patternAdapter pattern
Adapter pattern
Shakil Ahmed
 
Design pattern-presentation
Design pattern-presentationDesign pattern-presentation
Design pattern-presentation
Rana Muhammad Asif
 
Incremental model
Incremental modelIncremental model
Incremental model
Hpibmx
 
Facade pattern
Facade patternFacade pattern
Facade pattern
JAINIK PATEL
 
Reusibility vs Extensibility in OOAD
Reusibility vs Extensibility in OOADReusibility vs Extensibility in OOAD
Reusibility vs Extensibility in OOAD
Shivani Kapoor
 
Fundamental design concepts
Fundamental design conceptsFundamental design concepts
Fundamental design concepts
srijavel
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
Anuja Arosha
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
Dr. C.V. Suresh Babu
 
Behavioral Design Patterns
Behavioral Design PatternsBehavioral Design Patterns
Behavioral Design Patterns
Lidan Hifi
 
Object oriented-systems-development-life-cycle ppt
Object oriented-systems-development-life-cycle pptObject oriented-systems-development-life-cycle ppt
Object oriented-systems-development-life-cycle ppt
Kunal Kishor Nirala
 
Publish Subscribe pattern - Design Patterns
Publish Subscribe pattern - Design PatternsPublish Subscribe pattern - Design Patterns
Publish Subscribe pattern - Design Patterns
Rutvik Bapat
 
Architectural modeling chapter 5 of omd
Architectural modeling chapter 5 of omdArchitectural modeling chapter 5 of omd
Architectural modeling chapter 5 of omd
jayashri kolekar
 
PATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsPATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design Patterns
Michael Heron
 
PATTERNS04 - Structural Design Patterns
PATTERNS04 - Structural Design PatternsPATTERNS04 - Structural Design Patterns
PATTERNS04 - Structural Design Patterns
Michael Heron
 
Design patterns creational patterns
Design patterns creational patternsDesign patterns creational patterns
Design patterns creational patterns
Malik Sajid
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
artgreen
 
Domain class model
Domain class modelDomain class model
Domain class model
shekharsj
 
Incremental model
Incremental modelIncremental model
Incremental model
Hpibmx
 
Reusibility vs Extensibility in OOAD
Reusibility vs Extensibility in OOADReusibility vs Extensibility in OOAD
Reusibility vs Extensibility in OOAD
Shivani Kapoor
 
Fundamental design concepts
Fundamental design conceptsFundamental design concepts
Fundamental design concepts
srijavel
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
Dr. C.V. Suresh Babu
 
Behavioral Design Patterns
Behavioral Design PatternsBehavioral Design Patterns
Behavioral Design Patterns
Lidan Hifi
 
Object oriented-systems-development-life-cycle ppt
Object oriented-systems-development-life-cycle pptObject oriented-systems-development-life-cycle ppt
Object oriented-systems-development-life-cycle ppt
Kunal Kishor Nirala
 
Publish Subscribe pattern - Design Patterns
Publish Subscribe pattern - Design PatternsPublish Subscribe pattern - Design Patterns
Publish Subscribe pattern - Design Patterns
Rutvik Bapat
 
Architectural modeling chapter 5 of omd
Architectural modeling chapter 5 of omdArchitectural modeling chapter 5 of omd
Architectural modeling chapter 5 of omd
jayashri kolekar
 
PATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsPATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design Patterns
Michael Heron
 

Viewers also liked (19)

Security and Integrity of Data
Security and Integrity of DataSecurity and Integrity of Data
Security and Integrity of Data
Adeel Riaz
 
Design Pattern
Design PatternDesign Pattern
Design Pattern
Himanshu
 
Behavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka PradhanBehavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka Pradhan
Priyanka Pradhan
 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
Aman Jain
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
Adeel Riaz
 
Structural Design pattern - Adapter
Structural Design pattern - AdapterStructural Design pattern - Adapter
Structural Design pattern - Adapter
Manoj Kumar
 
Reliability and its principals
Reliability and its principalsReliability and its principals
Reliability and its principals
Himanshu
 
CBAM
 CBAM CBAM
CBAM
Asim Shahzad
 
Structural and functional testing
Structural and functional testingStructural and functional testing
Structural and functional testing
Himanshu
 
Architecture Review
Architecture ReviewArchitecture Review
Architecture Review
Himanshu
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
guy_davis
 
Software reliability tools and common software errors
Software reliability tools and common software errorsSoftware reliability tools and common software errors
Software reliability tools and common software errors
Himanshu
 
Business analysis in data warehousing
Business analysis in data warehousingBusiness analysis in data warehousing
Business analysis in data warehousing
Himanshu
 
Abc
AbcAbc
Abc
Himanshu
 
Importance of software architecture
Importance of software architectureImportance of software architecture
Importance of software architecture
Himanshu
 
Saam
SaamSaam
Saam
Himanshu
 
Software archiecture lecture07
Software archiecture   lecture07Software archiecture   lecture07
Software archiecture lecture07
Luktalja
 
Architecture business cycle
Architecture business cycleArchitecture business cycle
Architecture business cycle
Himanshu
 
ATAM
ATAMATAM
ATAM
Himanshu
 
Security and Integrity of Data
Security and Integrity of DataSecurity and Integrity of Data
Security and Integrity of Data
Adeel Riaz
 
Design Pattern
Design PatternDesign Pattern
Design Pattern
Himanshu
 
Behavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka PradhanBehavioral pattern By:-Priyanka Pradhan
Behavioral pattern By:-Priyanka Pradhan
Priyanka Pradhan
 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
Aman Jain
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
Adeel Riaz
 
Structural Design pattern - Adapter
Structural Design pattern - AdapterStructural Design pattern - Adapter
Structural Design pattern - Adapter
Manoj Kumar
 
Reliability and its principals
Reliability and its principalsReliability and its principals
Reliability and its principals
Himanshu
 
Structural and functional testing
Structural and functional testingStructural and functional testing
Structural and functional testing
Himanshu
 
Architecture Review
Architecture ReviewArchitecture Review
Architecture Review
Himanshu
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
guy_davis
 
Software reliability tools and common software errors
Software reliability tools and common software errorsSoftware reliability tools and common software errors
Software reliability tools and common software errors
Himanshu
 
Business analysis in data warehousing
Business analysis in data warehousingBusiness analysis in data warehousing
Business analysis in data warehousing
Himanshu
 
Importance of software architecture
Importance of software architectureImportance of software architecture
Importance of software architecture
Himanshu
 
Software archiecture lecture07
Software archiecture   lecture07Software archiecture   lecture07
Software archiecture lecture07
Luktalja
 
Architecture business cycle
Architecture business cycleArchitecture business cycle
Architecture business cycle
Himanshu
 
Ad

Similar to Structural patterns (20)

Design pattern of software words computer .pptx
Design pattern of software words computer .pptxDesign pattern of software words computer .pptx
Design pattern of software words computer .pptx
muslimpari2503
 
6 Design Pattern.ppt design pattern in softeare engineering
6 Design Pattern.ppt design pattern in softeare engineering6 Design Pattern.ppt design pattern in softeare engineering
6 Design Pattern.ppt design pattern in softeare engineering
MuhammadAbubakar114879
 
Design pattern and their application
Design pattern and their applicationDesign pattern and their application
Design pattern and their application
Hiệp Tiến
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane1
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane2
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns Structural
UMAR ALI
 
Design patterns software re engineering lect 10
Design patterns software re engineering lect 10Design patterns software re engineering lect 10
Design patterns software re engineering lect 10
HibaAmjadSiddiqui
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
Mindfire Solutions
 
JS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptxJS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptx
husnainali397602
 
note2_DesignPatterns (1).pptx
note2_DesignPatterns (1).pptxnote2_DesignPatterns (1).pptx
note2_DesignPatterns (1).pptx
ReemaAsker1
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
stanbridge
 
Design patterns represent the best practices used by experienced object-orien...
Design patterns represent the best practices used by experienced object-orien...Design patterns represent the best practices used by experienced object-orien...
Design patterns represent the best practices used by experienced object-orien...
nevanak569
 
10-DesignPatterns.ppt
10-DesignPatterns.ppt10-DesignPatterns.ppt
10-DesignPatterns.ppt
TAGADPALLEWARPARTHVA
 
OOPSDesign PPT ( introduction to opps and design (
OOPSDesign PPT ( introduction to opps and design (OOPSDesign PPT ( introduction to opps and design (
OOPSDesign PPT ( introduction to opps and design (
bhfcvh531
 
Software Architecture and Design Patterns Notes.pptx
Software Architecture and Design Patterns Notes.pptxSoftware Architecture and Design Patterns Notes.pptx
Software Architecture and Design Patterns Notes.pptx
VivekanandaGN2
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
anguraju1
 
Decorator Pattern
Decorator PatternDecorator Pattern
Decorator Pattern
Dimuthu Anuraj
 
Creational Design Patterns.pptx
Creational Design Patterns.pptxCreational Design Patterns.pptx
Creational Design Patterns.pptx
Sachin Patidar
 
Design_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.pptDesign_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.ppt
C Meenakshi Meyyappan
 
Related Worksheets
Related WorksheetsRelated Worksheets
Related Worksheets
Eirik Bakke
 
Design pattern of software words computer .pptx
Design pattern of software words computer .pptxDesign pattern of software words computer .pptx
Design pattern of software words computer .pptx
muslimpari2503
 
6 Design Pattern.ppt design pattern in softeare engineering
6 Design Pattern.ppt design pattern in softeare engineering6 Design Pattern.ppt design pattern in softeare engineering
6 Design Pattern.ppt design pattern in softeare engineering
MuhammadAbubakar114879
 
Design pattern and their application
Design pattern and their applicationDesign pattern and their application
Design pattern and their application
Hiệp Tiến
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane1
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane2
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns Structural
UMAR ALI
 
Design patterns software re engineering lect 10
Design patterns software re engineering lect 10Design patterns software re engineering lect 10
Design patterns software re engineering lect 10
HibaAmjadSiddiqui
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
Mindfire Solutions
 
JS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptxJS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptx
husnainali397602
 
note2_DesignPatterns (1).pptx
note2_DesignPatterns (1).pptxnote2_DesignPatterns (1).pptx
note2_DesignPatterns (1).pptx
ReemaAsker1
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
stanbridge
 
Design patterns represent the best practices used by experienced object-orien...
Design patterns represent the best practices used by experienced object-orien...Design patterns represent the best practices used by experienced object-orien...
Design patterns represent the best practices used by experienced object-orien...
nevanak569
 
OOPSDesign PPT ( introduction to opps and design (
OOPSDesign PPT ( introduction to opps and design (OOPSDesign PPT ( introduction to opps and design (
OOPSDesign PPT ( introduction to opps and design (
bhfcvh531
 
Software Architecture and Design Patterns Notes.pptx
Software Architecture and Design Patterns Notes.pptxSoftware Architecture and Design Patterns Notes.pptx
Software Architecture and Design Patterns Notes.pptx
VivekanandaGN2
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
anguraju1
 
Creational Design Patterns.pptx
Creational Design Patterns.pptxCreational Design Patterns.pptx
Creational Design Patterns.pptx
Sachin Patidar
 
Related Worksheets
Related WorksheetsRelated Worksheets
Related Worksheets
Eirik Bakke
 
Ad

More from Himanshu (20)

Software product line
Software product lineSoftware product line
Software product line
Himanshu
 
Shared information systems
Shared information systemsShared information systems
Shared information systems
Himanshu
 
Saam
SaamSaam
Saam
Himanshu
 
White box black box & gray box testing
White box black box & gray box testingWhite box black box & gray box testing
White box black box & gray box testing
Himanshu
 
Pareto analysis
Pareto analysisPareto analysis
Pareto analysis
Himanshu
 
Load runner & win runner
Load runner & win runnerLoad runner & win runner
Load runner & win runner
Himanshu
 
Crud and jad
Crud and jadCrud and jad
Crud and jad
Himanshu
 
Junit and cactus
Junit and cactusJunit and cactus
Junit and cactus
Himanshu
 
Risk based testing and random testing
Risk based testing and random testingRisk based testing and random testing
Risk based testing and random testing
Himanshu
 
Testing a data warehouses
Testing a data warehousesTesting a data warehouses
Testing a data warehouses
Himanshu
 
Software testing tools and its taxonomy
Software testing tools and its taxonomySoftware testing tools and its taxonomy
Software testing tools and its taxonomy
Himanshu
 
Software reliability engineering process
Software reliability engineering processSoftware reliability engineering process
Software reliability engineering process
Himanshu
 
Software reliability growth model
Software reliability growth modelSoftware reliability growth model
Software reliability growth model
Himanshu
 
Regression and performance testing
Regression and performance testingRegression and performance testing
Regression and performance testing
Himanshu
 
Eleven step of software testing process
Eleven step of software testing processEleven step of software testing process
Eleven step of software testing process
Himanshu
 
Off the-shelf components (cots)
Off the-shelf components (cots)Off the-shelf components (cots)
Off the-shelf components (cots)
Himanshu
 
Building a software testing environment
Building a software testing environmentBuilding a software testing environment
Building a software testing environment
Himanshu
 
Reconstructing Software Architecture
Reconstructing Software ArchitectureReconstructing Software Architecture
Reconstructing Software Architecture
Himanshu
 
Design pattern & categories
Design pattern & categoriesDesign pattern & categories
Design pattern & categories
Himanshu
 
Cost Benefit Analysis Method
Cost Benefit Analysis MethodCost Benefit Analysis Method
Cost Benefit Analysis Method
Himanshu
 
Software product line
Software product lineSoftware product line
Software product line
Himanshu
 
Shared information systems
Shared information systemsShared information systems
Shared information systems
Himanshu
 
White box black box & gray box testing
White box black box & gray box testingWhite box black box & gray box testing
White box black box & gray box testing
Himanshu
 
Pareto analysis
Pareto analysisPareto analysis
Pareto analysis
Himanshu
 
Load runner & win runner
Load runner & win runnerLoad runner & win runner
Load runner & win runner
Himanshu
 
Crud and jad
Crud and jadCrud and jad
Crud and jad
Himanshu
 
Junit and cactus
Junit and cactusJunit and cactus
Junit and cactus
Himanshu
 
Risk based testing and random testing
Risk based testing and random testingRisk based testing and random testing
Risk based testing and random testing
Himanshu
 
Testing a data warehouses
Testing a data warehousesTesting a data warehouses
Testing a data warehouses
Himanshu
 
Software testing tools and its taxonomy
Software testing tools and its taxonomySoftware testing tools and its taxonomy
Software testing tools and its taxonomy
Himanshu
 
Software reliability engineering process
Software reliability engineering processSoftware reliability engineering process
Software reliability engineering process
Himanshu
 
Software reliability growth model
Software reliability growth modelSoftware reliability growth model
Software reliability growth model
Himanshu
 
Regression and performance testing
Regression and performance testingRegression and performance testing
Regression and performance testing
Himanshu
 
Eleven step of software testing process
Eleven step of software testing processEleven step of software testing process
Eleven step of software testing process
Himanshu
 
Off the-shelf components (cots)
Off the-shelf components (cots)Off the-shelf components (cots)
Off the-shelf components (cots)
Himanshu
 
Building a software testing environment
Building a software testing environmentBuilding a software testing environment
Building a software testing environment
Himanshu
 
Reconstructing Software Architecture
Reconstructing Software ArchitectureReconstructing Software Architecture
Reconstructing Software Architecture
Himanshu
 
Design pattern & categories
Design pattern & categoriesDesign pattern & categories
Design pattern & categories
Himanshu
 
Cost Benefit Analysis Method
Cost Benefit Analysis MethodCost Benefit Analysis Method
Cost Benefit Analysis Method
Himanshu
 

Recently uploaded (20)

SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 

Structural patterns

  • 1. Structural PatternStructural Pattern Dr. Himanshu Hora SRMS College of Engineering & Technology Bareilly (UP) INDIA Dr. Himanshu Hora SRMS College of Engineering & Technology Bareilly (UP) INDIA 01/16/16 Structural Pattern 1
  • 2. ContentContent • History of Design Pattern • Definitions of Design Pattern • Types of Pattern • Adapter • Bridge • Composite • Decorator • Facade • Flyweight • Proxy • Benefits and Possible problems • History of Design Pattern • Definitions of Design Pattern • Types of Pattern • Adapter • Bridge • Composite • Decorator • Facade • Flyweight • Proxy • Benefits and Possible problems 01/16/16 Structural Pattern 2
  • 3. History of Design PatternHistory of Design Pattern • In 1994, Design Patterns: Elements of Reusable Object- Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides explained the usefulness of patterns and resulted in the widespread popularity of design patterns. • These four authors together are referred to as the Gang of Four (GoF). • In 1994, Design Patterns: Elements of Reusable Object- Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides explained the usefulness of patterns and resulted in the widespread popularity of design patterns. • These four authors together are referred to as the Gang of Four (GoF). 01/16/16 Structural Pattern 3
  • 4. Definitions of Design PatternDefinitions of Design Pattern • Design patterns are recurring solutions to software design problems you find again and again in real-world application development OR • Design patterns represent solutions to problems that arise when developing software within a particular context OR • Design patterns are standard solutions to common problems in software design • Design patterns are recurring solutions to software design problems you find again and again in real-world application development OR • Design patterns represent solutions to problems that arise when developing software within a particular context OR • Design patterns are standard solutions to common problems in software design 01/16/16 Structural Pattern 4
  • 5. Types of PatternTypes of Pattern There are 3 types of pattern • Creational: address problems of creating an object in a flexible way. Separate creation, from operation/use. • Structural: address problems of using O-O constructs like inheritance to organize classes and objects • Behavioral: address problems of assigning responsibilities to classes. Suggest both static relationships and patterns of communication (use cases) There are 3 types of pattern • Creational: address problems of creating an object in a flexible way. Separate creation, from operation/use. • Structural: address problems of using O-O constructs like inheritance to organize classes and objects • Behavioral: address problems of assigning responsibilities to classes. Suggest both static relationships and patterns of communication (use cases) 01/16/16 Structural Pattern 5
  • 6. Types of PatternTypes of Pattern Creational Patterns (concerned with abstracting the object-instantiation process) • Factory Method Abstract Factory Singleton • Builder Prototype Structural Patterns (concerned with how objects/classes can be combined to form larger structures) • Adapter Bridge Composite • Decorator Facade Flyweight • Proxy Behavioral Patterns (concerned with communication between objects) • Command Interpreter Iterator • Mediator Observer State • Strategy Chain of Responsibility Visitor • Template Method Creational Patterns (concerned with abstracting the object-instantiation process) • Factory Method Abstract Factory Singleton • Builder Prototype Structural Patterns (concerned with how objects/classes can be combined to form larger structures) • Adapter Bridge Composite • Decorator Facade Flyweight • Proxy Behavioral Patterns (concerned with communication between objects) • Command Interpreter Iterator • Mediator Observer State • Strategy Chain of Responsibility Visitor • Template Method 01/16/16 Structural Pattern 6
  • 7. AdapterAdapter • Convert the interface of a class into another interface clients expect • Adapter lets classes work together that couldn't otherwise because of incompatible interfaces • Use the Adapter pattern when: – you want to use an existing class and its interface does not match the one you need – you need to use several existing subclasses, but it's impractical to adapt their interface by subclassing everyone. An object adapter can adapt the interface of its parent class • Convert the interface of a class into another interface clients expect • Adapter lets classes work together that couldn't otherwise because of incompatible interfaces • Use the Adapter pattern when: – you want to use an existing class and its interface does not match the one you need – you need to use several existing subclasses, but it's impractical to adapt their interface by subclassing everyone. An object adapter can adapt the interface of its parent class 01/16/16 Structural Pattern 7
  • 9. BridgeBridge • Decouple an abstraction from its implementation so that the two can vary independently • Use the Bridge pattern when: – you want run-time binding of the implementation – you want to share an implementation among multiple objects • Decouple an abstraction from its implementation so that the two can vary independently • Use the Bridge pattern when: – you want run-time binding of the implementation – you want to share an implementation among multiple objects 01/16/16 Structural Pattern 9
  • 11. CompositeComposite • Compose objects into tree structures to represent whole-part hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly • Use this pattern whenever you have "composites that contain components, each of which could be a composite". • Compose objects into tree structures to represent whole-part hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly • Use this pattern whenever you have "composites that contain components, each of which could be a composite". 01/16/16 Structural Pattern 11
  • 13. DecoratorDecorator • Attach additional responsibilities to an object dynamically • Decorators provide a flexible alternative to subclassing for extending functionality • Attach additional responsibilities to an object dynamically • Decorators provide a flexible alternative to subclassing for extending functionality 01/16/16 Structural Pattern 13
  • 14. ProblemsProblems • Several classes with a similar operation (method), but different behavior. • We want to use many combinations of these behaviors • Several classes with a similar operation (method), but different behavior. • We want to use many combinations of these behaviors 01/16/16 Structural Pattern 14
  • 15. Example - Automated HospitalExample - Automated Hospital • People come to the reception with problems • They describe their problems • A special doctoRobot is created that is specialized to treat their special situations. • People come to the reception with problems • They describe their problems • A special doctoRobot is created that is specialized to treat their special situations. 01/16/16 Structural Pattern 15
  • 16. Automated Hospital - Solution 1Automated Hospital - Solution 1 DoctoRobot Cure (p : Patient) DentistRobot Cure (p : Patient) DermaRobot Cure (p : Patient) PsychoRobot Cure (p : Patient) DentistDermaRobot DentistPsychoRobot DermaPsychoRobot 01/16/16 Structural Pattern 16
  • 17. Problems with solution-1Problems with solution-1 • Sometimes we don’t have multiple inheritance. • Even if we have, if is problematic, and bad design. • Sometimes we don’t have multiple inheritance. • Even if we have, if is problematic, and bad design. 01/16/16 Structural Pattern 17
  • 18. A Better idea: Use DecoratorA Better idea: Use Decorator ConcreteComponent Operation( ) ConcreteDecoratorA addedState Operation( ) ConcreteDecoratorB Operation( ) Decorator Operation( ) Component Operation( ) component 01/16/16 Structural Pattern 18
  • 19. Decorator in our caseDecorator in our case DentistRobot Cure (p : Patient) DermaRobot Cure (p : Patient) PhsychoRobot Cure (p : Patient) DoctorRobotDecorator innerDoctor Cure (p : Patient) DoctoRobot Cure (p : Patient) component 01/16/16 Structural Pattern 19
  • 20. FacadeFacade • Provide a unified interface to a set of interfaces in a subsystem • Facade defines a higher-level interface that makes the subsystem easier to use • Create a class that is the interface to the subsystem • Clients interface with the Facade class to deal with the subsystem • It hides the implementation of the subsystem from clients • It promotes weak coupling between the subsystems and its clients • It does not prevent clients from using subsystems class, should it? • Provide a unified interface to a set of interfaces in a subsystem • Facade defines a higher-level interface that makes the subsystem easier to use • Create a class that is the interface to the subsystem • Clients interface with the Facade class to deal with the subsystem • It hides the implementation of the subsystem from clients • It promotes weak coupling between the subsystems and its clients • It does not prevent clients from using subsystems class, should it? 01/16/16 Structural Pattern 20
  • 22. FlyweightFlyweight • Use sharing to support large numbers of fine-grained objects efficiently • The pattern can be used when: – The program uses a large number of objects and – The program does not use object identity (==) • Use sharing to support large numbers of fine-grained objects efficiently • The pattern can be used when: – The program uses a large number of objects and – The program does not use object identity (==) 01/16/16 Structural Pattern 22
  • 24. ProxyProxy • Provide a surrogate or placeholder for another object to control access to it. • The proxy has the same interface as the original object • Virtual Proxy: – Creates/accesses expensive objects on demand – You may wish to delay creating an expensive object until it is really accessed – It may be too expensive to keep entire state of the object in memory at one time • Provide a surrogate or placeholder for another object to control access to it. • The proxy has the same interface as the original object • Virtual Proxy: – Creates/accesses expensive objects on demand – You may wish to delay creating an expensive object until it is really accessed – It may be too expensive to keep entire state of the object in memory at one time 01/16/16 Structural Pattern 24
  • 25. • Protection Proxy – Provides different objects different level of access to original object • Cache Proxy (Server Proxy) – Multiple local clients can share results from expensive operations: remote accesses or long computations • Firewall Proxy – Protect local clients from outside world • Protection Proxy – Provides different objects different level of access to original object • Cache Proxy (Server Proxy) – Multiple local clients can share results from expensive operations: remote accesses or long computations • Firewall Proxy – Protect local clients from outside world 01/16/16 Structural Pattern 25
  • 27. Benefits • Flexible • Don’t have to foresee all combinations • Little objects Possible problems • Performance • Decorators are not necessarily always cummutative (surgeon and Anastasiolic) 01/16/16 Structural Pattern 27
  • 28. Thank You 01/16/16 Structural Pattern 28 Dr. Himanshu Hora SRMS College of Engineering & Technology Bareilly (UP) INDIA Dr. Himanshu Hora SRMS College of Engineering & Technology Bareilly (UP) INDIA