SlideShare a Scribd company logo
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]

More Related Content

What's hot

Object oriented modeling
Object oriented modelingObject oriented modeling
Object oriented modeling
Pooja Dixit
 
Encapsulation of operations, methods & persistence
Encapsulation of operations, methods & persistenceEncapsulation of operations, methods & persistence
Encapsulation of operations, methods & persistence
Prem Lamsal
 
Concept of Object Oriented Programming
Concept of Object Oriented Programming Concept of Object Oriented Programming
Concept of Object Oriented Programming
Prognoz Technologies Pvt. Ltd.
 
Design patterns
Design patternsDesign patterns
Design patterns
Anas Alpure
 
PATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsPATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design Patterns
Michael Heron
 
Sda 8
Sda   8Sda   8
Object database standards, languages and design
Object database standards, languages and designObject database standards, languages and design
Object database standards, languages and design
Dabbal Singh Mahara
 
Oops slide
Oops slide Oops slide
Oops slide
Ashok Sharma
 
Oops
OopsOops
Composite Design Pattern
Composite Design PatternComposite Design Pattern
Composite Design Pattern
Raj Chanchal
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
Pina 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 Framework
Raveendra R
 
Design patterns
Design patternsDesign patterns
Design patterns
Vignesh Nethaji
 
Ashish oot
Ashish ootAshish oot
Ashish oot
Ashish Agrawal
 
M04 Design Patterns
M04 Design PatternsM04 Design Patterns
M04 Design Patterns
Dang Tuan
 
Visitor pattern
Visitor patternVisitor pattern
Visitor pattern
Nikunj Dhameliya
 
Oop concepts
Oop conceptsOop concepts
Oop concepts
Ritu Mangla
 
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
Trey Brister
 
encapsulation
encapsulationencapsulation
encapsulation
shalini392
 

What's hot (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
 

Viewers also liked

Flyweight Pattern
Flyweight PatternFlyweight Pattern
Flyweight Pattern
Hüseyin Ergin
 
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
eprafulla
 
Retail Institution Report
Retail Institution ReportRetail Institution Report
Retail Institution Report
Fridz Felisco
 
Javascript Common Design Patterns
Javascript Common Design PatternsJavascript Common Design Patterns
Javascript Common Design Patterns
Pham Huy Tung
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
Rothana 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 Pattern
eprafulla
 
Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2
Savio Sebastian
 
Command pattern
Command patternCommand pattern
Command pattern
Shakil Ahmed
 
Command and Adapter Pattern
Command and Adapter PatternCommand and Adapter Pattern
Command and Adapter Pattern
Jonathan Simon
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
guy_davis
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
Shahriar Hyder
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
Adeel Riaz
 

Viewers also liked (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 to Design Patterns - 03 Composite and Flyweight Pattern

Design patterns
Design patternsDesign patterns
Design patterns
Elyes Mejri
 
designpatterns-.pdf
designpatterns-.pdfdesignpatterns-.pdf
designpatterns-.pdf
ElviraSolnyshkina
 
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
 
Remus_3_0
Remus_3_0Remus_3_0
Remus_3_0
Prashasth Patil
 
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
sreeja_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 do
Susan 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 microsoft
Raghu nath
 
Day5
Day5Day5
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
jane3dyson92312
 
UML
UMLUML
Part2- The Atomic Information Resource
Part2- The Atomic Information ResourcePart2- The Atomic Information Resource
Part2- The Atomic Information Resource
JEAN-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.pdf
mulugetaberihun3
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
Ami Mahloof
 
Terraform Modules Restructured
Terraform Modules RestructuredTerraform Modules Restructured
Terraform Modules Restructured
DoiT International
 
Ch08
Ch08Ch08
Ch08
Ch08Ch08
D0373024030
D0373024030D0373024030
D0373024030
theijes
 

Similar to 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
 

Recently uploaded

一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
kecekev
 
定制美国西雅图城市大学毕业证学历证书原版一模一样
定制美国西雅图城市大学毕业证学历证书原版一模一样定制美国西雅图城市大学毕业证学历证书原版一模一样
定制美国西雅图城市大学毕业证学历证书原版一模一样
qo1as76n
 
UNIT IV-VISUAL STYLE AND MOBILE INTERFACES.pptx
UNIT IV-VISUAL STYLE AND MOBILE INTERFACES.pptxUNIT IV-VISUAL STYLE AND MOBILE INTERFACES.pptx
UNIT IV-VISUAL STYLE AND MOBILE INTERFACES.pptx
GOWSIKRAJA PALANISAMY
 
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design ProcessStorytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
 
UNIT V ACTIONS AND COMMANDS, FORMS AND CONTROLS.pptx
UNIT V ACTIONS AND COMMANDS, FORMS AND CONTROLS.pptxUNIT V ACTIONS AND COMMANDS, FORMS AND CONTROLS.pptx
UNIT V ACTIONS AND COMMANDS, FORMS AND CONTROLS.pptx
GOWSIKRAJA PALANISAMY
 
一比一原版(BU毕业证)波士顿大学毕业证如何办理
一比一原版(BU毕业证)波士顿大学毕业证如何办理一比一原版(BU毕业证)波士顿大学毕业证如何办理
一比一原版(BU毕业证)波士顿大学毕业证如何办理
peuce
 
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
gpffo76j
 
Branding de la empresa de Bolt- 2024.pdf
Branding de la empresa de Bolt- 2024.pdfBranding de la empresa de Bolt- 2024.pdf
Branding de la empresa de Bolt- 2024.pdf
PabloMartelLpez
 
ARENA - Young adults in the workplace (Knight Moves).pdf
ARENA - Young adults in the workplace (Knight Moves).pdfARENA - Young adults in the workplace (Knight Moves).pdf
ARENA - Young adults in the workplace (Knight Moves).pdf
Knight Moves
 
PDF SubmissionDigital Marketing Institute in Noida
PDF SubmissionDigital Marketing Institute in NoidaPDF SubmissionDigital Marketing Institute in Noida
PDF SubmissionDigital Marketing Institute in Noida
PoojaSaini954651
 
Heuristics Evaluation - How to Guide.pdf
Heuristics Evaluation - How to Guide.pdfHeuristics Evaluation - How to Guide.pdf
Heuristics Evaluation - How to Guide.pdf
Jaime Brown
 
Timeless Principles of Good Design
Timeless Principles of Good DesignTimeless Principles of Good Design
Timeless Principles of Good Design
Carolina de Bartolo
 
Technoblade The Legacy of a Minecraft Legend.
Technoblade The Legacy of a Minecraft Legend.Technoblade The Legacy of a Minecraft Legend.
Technoblade The Legacy of a Minecraft Legend.
Techno Merch
 
Revolutionizing the Digital Landscape: Web Development Companies in India
Revolutionizing the Digital Landscape: Web Development Companies in IndiaRevolutionizing the Digital Landscape: Web Development Companies in India
Revolutionizing the Digital Landscape: Web Development Companies in India
amrsoftec1
 
AHMED TALAAT ARCHITECTURE PORTFOLIO .pdf
AHMED TALAAT ARCHITECTURE PORTFOLIO .pdfAHMED TALAAT ARCHITECTURE PORTFOLIO .pdf
AHMED TALAAT ARCHITECTURE PORTFOLIO .pdf
talaatahm
 
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANEEASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
Febless Hernane
 
Impact of Fonts: in Web and Apps Design
Impact of Fonts:  in Web and Apps DesignImpact of Fonts:  in Web and Apps Design
Impact of Fonts: in Web and Apps Design
contactproperweb2014
 
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdfSECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
eloprejohn333
 
Virtual Tour Application Powerpoint for museum of edinburgh
Virtual Tour Application Powerpoint for museum of edinburghVirtual Tour Application Powerpoint for museum of edinburgh
Virtual Tour Application Powerpoint for museum of edinburgh
millarj46
 
NHR Engineers Portfolio 2023 2024 NISHANT RATHI
NHR Engineers Portfolio 2023 2024 NISHANT RATHINHR Engineers Portfolio 2023 2024 NISHANT RATHI
NHR Engineers Portfolio 2023 2024 NISHANT RATHI
NishantRathi18
 

Recently uploaded (20)

一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
一比一原版(UW毕业证)西雅图华盛顿大学毕业证如何办理
 
定制美国西雅图城市大学毕业证学历证书原版一模一样
定制美国西雅图城市大学毕业证学历证书原版一模一样定制美国西雅图城市大学毕业证学历证书原版一模一样
定制美国西雅图城市大学毕业证学历证书原版一模一样
 
UNIT IV-VISUAL STYLE AND MOBILE INTERFACES.pptx
UNIT IV-VISUAL STYLE AND MOBILE INTERFACES.pptxUNIT IV-VISUAL STYLE AND MOBILE INTERFACES.pptx
UNIT IV-VISUAL STYLE AND MOBILE INTERFACES.pptx
 
Storytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design ProcessStorytelling For The Web: Integrate Storytelling in your Design Process
Storytelling For The Web: Integrate Storytelling in your Design Process
 
UNIT V ACTIONS AND COMMANDS, FORMS AND CONTROLS.pptx
UNIT V ACTIONS AND COMMANDS, FORMS AND CONTROLS.pptxUNIT V ACTIONS AND COMMANDS, FORMS AND CONTROLS.pptx
UNIT V ACTIONS AND COMMANDS, FORMS AND CONTROLS.pptx
 
一比一原版(BU毕业证)波士顿大学毕业证如何办理
一比一原版(BU毕业证)波士顿大学毕业证如何办理一比一原版(BU毕业证)波士顿大学毕业证如何办理
一比一原版(BU毕业证)波士顿大学毕业证如何办理
 
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
 
Branding de la empresa de Bolt- 2024.pdf
Branding de la empresa de Bolt- 2024.pdfBranding de la empresa de Bolt- 2024.pdf
Branding de la empresa de Bolt- 2024.pdf
 
ARENA - Young adults in the workplace (Knight Moves).pdf
ARENA - Young adults in the workplace (Knight Moves).pdfARENA - Young adults in the workplace (Knight Moves).pdf
ARENA - Young adults in the workplace (Knight Moves).pdf
 
PDF SubmissionDigital Marketing Institute in Noida
PDF SubmissionDigital Marketing Institute in NoidaPDF SubmissionDigital Marketing Institute in Noida
PDF SubmissionDigital Marketing Institute in Noida
 
Heuristics Evaluation - How to Guide.pdf
Heuristics Evaluation - How to Guide.pdfHeuristics Evaluation - How to Guide.pdf
Heuristics Evaluation - How to Guide.pdf
 
Timeless Principles of Good Design
Timeless Principles of Good DesignTimeless Principles of Good Design
Timeless Principles of Good Design
 
Technoblade The Legacy of a Minecraft Legend.
Technoblade The Legacy of a Minecraft Legend.Technoblade The Legacy of a Minecraft Legend.
Technoblade The Legacy of a Minecraft Legend.
 
Revolutionizing the Digital Landscape: Web Development Companies in India
Revolutionizing the Digital Landscape: Web Development Companies in IndiaRevolutionizing the Digital Landscape: Web Development Companies in India
Revolutionizing the Digital Landscape: Web Development Companies in India
 
AHMED TALAAT ARCHITECTURE PORTFOLIO .pdf
AHMED TALAAT ARCHITECTURE PORTFOLIO .pdfAHMED TALAAT ARCHITECTURE PORTFOLIO .pdf
AHMED TALAAT ARCHITECTURE PORTFOLIO .pdf
 
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANEEASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANE
 
Impact of Fonts: in Web and Apps Design
Impact of Fonts:  in Web and Apps DesignImpact of Fonts:  in Web and Apps Design
Impact of Fonts: in Web and Apps Design
 
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdfSECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
SECURING BUILDING PERMIT CITY OF CALOOCAN.pdf
 
Virtual Tour Application Powerpoint for museum of edinburgh
Virtual Tour Application Powerpoint for museum of edinburghVirtual Tour Application Powerpoint for museum of edinburgh
Virtual Tour Application Powerpoint for museum of edinburgh
 
NHR Engineers Portfolio 2023 2024 NISHANT RATHI
NHR Engineers Portfolio 2023 2024 NISHANT RATHINHR Engineers Portfolio 2023 2024 NISHANT RATHI
NHR Engineers Portfolio 2023 2024 NISHANT RATHI
 

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