SlideShare una empresa de Scribd logo
1 de 17
03 Composite and Flyweight Pattern Design Patterns © Prafulla Paraskar 2010
Composite Structural Design Pattern © Prafulla Paraskar 2010
Definition The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object.(wikipedia) © Prafulla Paraskar 2010
Composite Pattern – Explained (1/2) © Prafulla Paraskar 2010
Composite Pattern – Explained (2/2) Arranges structured hierarchies so that single components and groups of components can be treated in the same way. Makes easier to add new components. Makes client code simpler, since they do not have to know if they are dealing with one or more components. Typical operations on the components include add, remove, display, find and group. © Prafulla Paraskar 2010
Composite Pattern – UML Diagram © Prafulla Paraskar 2010
Composite Pattern – Real World Samples Files and folders in Windows Organization Tree Arithmetic Expressions like (2 + 4) * ( 5 + 6) Generic containers in .NET framework like list, queue, stack help implement  the composite pattern. © Prafulla Paraskar 2010
Composite Pattern – Guidelines You have : ,[object Object],You Want ,[object Object]
To treat all objects in a composite uniformly.© Prafulla Paraskar 2010
Flyweight Structural Design Pattern © Prafulla Paraskar 2010
Definition The Flyweight pattern is a pattern for sharing objects, where each instance does not contain its own state but stores it externally. This allows efficient sharing of objects to save space when there are many instances but only a few different types. (James W. Cooper – C# Design Patterns) © Prafulla Paraskar 2010
Flyweight Pattern – Explained (1/3) Designing objects down  to the lowest levels of  system "granularity”  provides optimal flexibility , but can be unacceptably  expensive in terms Row objects a p p a r e n t Row objects Character object Column object © Prafulla Paraskar 2010
Flyweight Pattern – Explained (2/3) column row row row a f e d c b g l k j i h Flyweight pool © Prafulla Paraskar 2010
Flyweight Pattern – Explained (3/3) Useful in cases where large number of objects (flyweights)required to provide “fine grain access” to the system.  Characteristics of flyweights are divided into intrinsic (inseparable) e.g. identity and extrinsic (separable) e.g. shared resource. Shared resource is taken care by a directory which manages enrollment  of participant  and provides on demand access to shared resources. Flyweights can only be created with help of a factory to enforce enrollment and sharing of resources.  © Prafulla Paraskar 2010
Flyweight Pattern – UML Diagram © Prafulla Paraskar 2010
Flyweight Pattern – Real World Samples Thumbnail representation of images in windows explorer.  Order processing system where the items are relatively similar and differ only in certain characteristics. Representation of files and folders in windows explorer. Individual cells in a spreadsheet program.  © Prafulla Paraskar 2010
Flyweight Pattern – Guidelines When: ,[object Object]

Más contenido relacionado

La actualidad más candente

Object oriented modeling
Object oriented modelingObject oriented modeling
Object oriented modelingPooja Dixit
 
Encapsulation of operations, methods & persistence
Encapsulation of operations, methods & persistenceEncapsulation of operations, methods & persistence
Encapsulation of operations, methods & persistencePrem Lamsal
 
PATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsPATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsMichael Heron
 
Object database standards, languages and design
Object database standards, languages and designObject database standards, languages and design
Object database standards, languages and designDabbal Singh Mahara
 
Composite Design Pattern
Composite Design PatternComposite Design Pattern
Composite Design PatternRaj Chanchal
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming conceptPina Parmar
 
[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)Muhammad Hammad Waseem
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate FrameworkRaveendra R
 
M04 Design Patterns
M04 Design PatternsM04 Design Patterns
M04 Design PatternsDang Tuan
 
All 23 Design patterns in one page front and back
All 23 Design patterns in one page front and backAll 23 Design patterns in one page front and back
All 23 Design patterns in one page front and backTrey Brister
 

La actualidad más candente (20)

Object oriented modeling
Object oriented modelingObject oriented modeling
Object oriented modeling
 
Encapsulation of operations, methods & persistence
Encapsulation of operations, methods & persistenceEncapsulation of operations, methods & persistence
Encapsulation of operations, methods & persistence
 
Concept of Object Oriented Programming
Concept of Object Oriented Programming Concept of Object Oriented Programming
Concept of Object Oriented Programming
 
Design patterns
Design patternsDesign patterns
Design patterns
 
PATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsPATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design Patterns
 
Sda 8
Sda   8Sda   8
Sda 8
 
Object database standards, languages and design
Object database standards, languages and designObject database standards, languages and design
Object database standards, languages and design
 
Oops slide
Oops slide Oops slide
Oops slide
 
Oops
OopsOops
Oops
 
Composite Design Pattern
Composite Design PatternComposite Design Pattern
Composite Design Pattern
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
 
[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate Framework
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Ashish oot
Ashish ootAshish oot
Ashish oot
 
M04 Design Patterns
M04 Design PatternsM04 Design Patterns
M04 Design Patterns
 
Visitor pattern
Visitor patternVisitor pattern
Visitor pattern
 
Oop concepts
Oop conceptsOop concepts
Oop concepts
 
All 23 Design patterns in one page front and back
All 23 Design patterns in one page front and backAll 23 Design patterns in one page front and back
All 23 Design patterns in one page front and back
 
encapsulation
encapsulationencapsulation
encapsulation
 

Destacado

Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Patterneprafulla
 
Retail Institution Report
Retail Institution ReportRetail Institution Report
Retail Institution ReportFridz Felisco
 
Javascript Common Design Patterns
Javascript Common Design PatternsJavascript Common Design Patterns
Javascript Common Design PatternsPham Huy Tung
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design PatternRothana Choun
 
Design Patterns - 04 Adapter and Facade Pattern
Design Patterns - 04 Adapter and Facade PatternDesign Patterns - 04 Adapter and Facade Pattern
Design Patterns - 04 Adapter and Facade Patterneprafulla
 
Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Savio Sebastian
 
Command and Adapter Pattern
Command and Adapter PatternCommand and Adapter Pattern
Command and Adapter PatternJonathan Simon
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Patternguy_davis
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design PatternShahriar Hyder
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design PatternAdeel Riaz
 

Destacado (12)

Flyweight Pattern
Flyweight PatternFlyweight Pattern
Flyweight Pattern
 
Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Pattern
 
Retail Institution Report
Retail Institution ReportRetail Institution Report
Retail Institution Report
 
Javascript Common Design Patterns
Javascript Common Design PatternsJavascript Common Design Patterns
Javascript Common Design Patterns
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
 
Design Patterns - 04 Adapter and Facade Pattern
Design Patterns - 04 Adapter and Facade PatternDesign Patterns - 04 Adapter and Facade Pattern
Design Patterns - 04 Adapter and Facade Pattern
 
Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2
 
Command pattern
Command patternCommand pattern
Command pattern
 
Command and Adapter Pattern
Command and Adapter PatternCommand and Adapter Pattern
Command and Adapter Pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 

Similar a Design Patterns - 03 Composite and Flyweight Pattern

UK INCOSE Annual Systems Engineering Conference. Case Study - Implementing TR...
UK INCOSE Annual Systems Engineering Conference. Case Study - Implementing TR...UK INCOSE Annual Systems Engineering Conference. Case Study - Implementing TR...
UK INCOSE Annual Systems Engineering Conference. Case Study - Implementing TR...Nic Plum
 
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISEsreeja_rajesh
 
Making your data work harder than you do
Making your data work harder than you doMaking your data work harder than you do
Making your data work harder than you doSusan Jane Williams
 
UML Design Class Diagrams (2014)
UML Design Class Diagrams (2014)UML Design Class Diagrams (2014)
UML Design Class Diagrams (2014)Miriam Ruiz
 
Design pattern (week 2)
Design pattern (week 2)Design pattern (week 2)
Design pattern (week 2)stanbridge
 
Applied xml programming for microsoft
Applied xml programming for microsoftApplied xml programming for microsoft
Applied xml programming for microsoftRaghu nath
 
Assignment # 2PreliminariesImportant Points· Evidence of acad.docx
Assignment  # 2PreliminariesImportant Points· Evidence of acad.docxAssignment  # 2PreliminariesImportant Points· Evidence of acad.docx
Assignment # 2PreliminariesImportant Points· Evidence of acad.docxjane3dyson92312
 
Part2- The Atomic Information Resource
Part2- The Atomic Information ResourcePart2- The Atomic Information Resource
Part2- The Atomic Information ResourceJEAN-MICHEL LETENNIER
 
QEBU: AN ADVANCED GRAPHICAL EDITOR FOR THE EBUCORE METADATA SET | Paolo PASIN...
QEBU: AN ADVANCED GRAPHICAL EDITOR FOR THE EBUCORE METADATA SET | Paolo PASIN...QEBU: AN ADVANCED GRAPHICAL EDITOR FOR THE EBUCORE METADATA SET | Paolo PASIN...
QEBU: AN ADVANCED GRAPHICAL EDITOR FOR THE EBUCORE METADATA SET | Paolo PASIN...FIAT/IFTA
 
software engineering Design Patterns.pdf
software  engineering Design   Patterns.pdfsoftware  engineering Design   Patterns.pdf
software engineering Design Patterns.pdfmulugetaberihun3
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructuredAmi Mahloof
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules RestructuredDoiT International
 
D0373024030
D0373024030D0373024030
D0373024030theijes
 

Similar a Design Patterns - 03 Composite and Flyweight Pattern (20)

Design patterns
Design patternsDesign patterns
Design patterns
 
designpatterns-.pdf
designpatterns-.pdfdesignpatterns-.pdf
designpatterns-.pdf
 
UK INCOSE Annual Systems Engineering Conference. Case Study - Implementing TR...
UK INCOSE Annual Systems Engineering Conference. Case Study - Implementing TR...UK INCOSE Annual Systems Engineering Conference. Case Study - Implementing TR...
UK INCOSE Annual Systems Engineering Conference. Case Study - Implementing TR...
 
Remus_3_0
Remus_3_0Remus_3_0
Remus_3_0
 
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
 
Making your data work harder than you do
Making your data work harder than you doMaking your data work harder than you do
Making your data work harder than you do
 
UML Design Class Diagrams (2014)
UML Design Class Diagrams (2014)UML Design Class Diagrams (2014)
UML Design Class Diagrams (2014)
 
Design pattern (week 2)
Design pattern (week 2)Design pattern (week 2)
Design pattern (week 2)
 
Applied xml programming for microsoft
Applied xml programming for microsoftApplied xml programming for microsoft
Applied xml programming for microsoft
 
Day5
Day5Day5
Day5
 
Assignment # 2PreliminariesImportant Points· Evidence of acad.docx
Assignment  # 2PreliminariesImportant Points· Evidence of acad.docxAssignment  # 2PreliminariesImportant Points· Evidence of acad.docx
Assignment # 2PreliminariesImportant Points· Evidence of acad.docx
 
UML
UMLUML
UML
 
Part2- The Atomic Information Resource
Part2- The Atomic Information ResourcePart2- The Atomic Information Resource
Part2- The Atomic Information Resource
 
QEBU: AN ADVANCED GRAPHICAL EDITOR FOR THE EBUCORE METADATA SET | Paolo PASIN...
QEBU: AN ADVANCED GRAPHICAL EDITOR FOR THE EBUCORE METADATA SET | Paolo PASIN...QEBU: AN ADVANCED GRAPHICAL EDITOR FOR THE EBUCORE METADATA SET | Paolo PASIN...
QEBU: AN ADVANCED GRAPHICAL EDITOR FOR THE EBUCORE METADATA SET | Paolo PASIN...
 
software engineering Design Patterns.pdf
software  engineering Design   Patterns.pdfsoftware  engineering Design   Patterns.pdf
software engineering Design Patterns.pdf
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules Restructured
 
Ch08
Ch08Ch08
Ch08
 
Ch08
Ch08Ch08
Ch08
 
D0373024030
D0373024030D0373024030
D0373024030
 

Último

How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Websitemark11275
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahimamgadibrahim92
 
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...gajnagarg
 
The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024Ilham Brata
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationZenSeloveres
 
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men 🔝dehradun🔝 Escor...
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men  🔝dehradun🔝   Escor...➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men  🔝dehradun🔝   Escor...
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men 🔝dehradun🔝 Escor...amitlee9823
 
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRLHingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRLNitya salvi
 
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...amitlee9823
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experiencedWhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experiencedNitya salvi
 
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.Nitya salvi
 
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service AvailableCall Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service AvailableNitya salvi
 
Hire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
Hire 💕 8617697112 Meerut Call Girls Service Call Girls AgencyHire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
Hire 💕 8617697112 Meerut Call Girls Service Call Girls AgencyNitya salvi
 
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Availabledollysharma2066
 
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...Delhi Call girls
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...amitlee9823
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...amitlee9823
 
Just Call Vip call girls diu Escorts ☎️9352988975 Two shot with one girl (diu )
Just Call Vip call girls diu Escorts ☎️9352988975 Two shot with one girl (diu )Just Call Vip call girls diu Escorts ☎️9352988975 Two shot with one girl (diu )
Just Call Vip call girls diu Escorts ☎️9352988975 Two shot with one girl (diu )gajnagarg
 

Último (20)

How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahim
 
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
Just Call Vip call girls dharamshala Escorts ☎️9352988975 Two shot with one g...
 
The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024The hottest UI and UX Design Trends 2024
The hottest UI and UX Design Trends 2024
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentation
 
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men 🔝dehradun🔝 Escor...
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men  🔝dehradun🔝   Escor...➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men  🔝dehradun🔝   Escor...
➥🔝 7737669865 🔝▻ dehradun Call-girls in Women Seeking Men 🔝dehradun🔝 Escor...
 
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRLHingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
Hingoli ❤CALL GIRL 8617370543 ❤CALL GIRLS IN Hingoli ESCORT SERVICE❤CALL GIRL
 
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experiencedWhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
WhatsApp Chat: 📞 8617697112 Call Girl Baran is experienced
 
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.
❤Personal Whatsapp Number 8617697112 Samba Call Girls 💦✅.
 
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service AvailableCall Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
Call Girls Jalgaon Just Call 8617370543Top Class Call Girl Service Available
 
Hire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
Hire 💕 8617697112 Meerut Call Girls Service Call Girls AgencyHire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
Hire 💕 8617697112 Meerut Call Girls Service Call Girls Agency
 
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
8377087607, Door Step Call Girls In Majnu Ka Tilla (Delhi) 24/7 Available
 
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Vasundhra (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 105, Noida Call girls :8448380779 Model Escorts | 100% verified
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
Just Call Vip call girls diu Escorts ☎️9352988975 Two shot with one girl (diu )
Just Call Vip call girls diu Escorts ☎️9352988975 Two shot with one girl (diu )Just Call Vip call girls diu Escorts ☎️9352988975 Two shot with one girl (diu )
Just Call Vip call girls diu Escorts ☎️9352988975 Two shot with one girl (diu )
 

Design Patterns - 03 Composite and Flyweight Pattern

  • 1. 03 Composite and Flyweight Pattern Design Patterns © Prafulla Paraskar 2010
  • 2. Composite Structural Design Pattern © Prafulla Paraskar 2010
  • 3. Definition The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object.(wikipedia) © Prafulla Paraskar 2010
  • 4. Composite Pattern – Explained (1/2) © Prafulla Paraskar 2010
  • 5. Composite Pattern – Explained (2/2) Arranges structured hierarchies so that single components and groups of components can be treated in the same way. Makes easier to add new components. Makes client code simpler, since they do not have to know if they are dealing with one or more components. Typical operations on the components include add, remove, display, find and group. © Prafulla Paraskar 2010
  • 6. Composite Pattern – UML Diagram © Prafulla Paraskar 2010
  • 7. Composite Pattern – Real World Samples Files and folders in Windows Organization Tree Arithmetic Expressions like (2 + 4) * ( 5 + 6) Generic containers in .NET framework like list, queue, stack help implement the composite pattern. © Prafulla Paraskar 2010
  • 8.
  • 9. To treat all objects in a composite uniformly.© Prafulla Paraskar 2010
  • 10. Flyweight Structural Design Pattern © Prafulla Paraskar 2010
  • 11. Definition The Flyweight pattern is a pattern for sharing objects, where each instance does not contain its own state but stores it externally. This allows efficient sharing of objects to save space when there are many instances but only a few different types. (James W. Cooper – C# Design Patterns) © Prafulla Paraskar 2010
  • 12. Flyweight Pattern – Explained (1/3) Designing objects down to the lowest levels of system "granularity” provides optimal flexibility , but can be unacceptably expensive in terms Row objects a p p a r e n t Row objects Character object Column object © Prafulla Paraskar 2010
  • 13. Flyweight Pattern – Explained (2/3) column row row row a f e d c b g l k j i h Flyweight pool © Prafulla Paraskar 2010
  • 14. Flyweight Pattern – Explained (3/3) Useful in cases where large number of objects (flyweights)required to provide “fine grain access” to the system. Characteristics of flyweights are divided into intrinsic (inseparable) e.g. identity and extrinsic (separable) e.g. shared resource. Shared resource is taken care by a directory which manages enrollment of participant and provides on demand access to shared resources. Flyweights can only be created with help of a factory to enforce enrollment and sharing of resources. © Prafulla Paraskar 2010
  • 15. Flyweight Pattern – UML Diagram © Prafulla Paraskar 2010
  • 16. Flyweight Pattern – Real World Samples Thumbnail representation of images in windows explorer. Order processing system where the items are relatively similar and differ only in certain characteristics. Representation of files and folders in windows explorer. Individual cells in a spreadsheet program. © Prafulla Paraskar 2010
  • 17.
  • 18. Different kinds of state, which can be handled differently to achieve space savings
  • 19. Group of objects that share state
  • 20. Ways of computing some of the state at runtime
  • 21.
  • 22. Thank you! http://geekswithblogs.net/technomad Presentation by Prafulla Paraskar prafulla.paraskar@s1.com © 2010 S1 India Pvt. Ltd. Presentation by Prafulla Paraskar eprafulla@gmail.com © 2010 Prafulla Paraskar