Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Flyweight Pattern Nik Reiman Joshua Hertz. Roadmap What is the Flyweight Pattern? UML When is Flyweight Useful? How to Use the Flyweight Pattern?

Similar presentations


Presentation on theme: "The Flyweight Pattern Nik Reiman Joshua Hertz. Roadmap What is the Flyweight Pattern? UML When is Flyweight Useful? How to Use the Flyweight Pattern?"— Presentation transcript:

1 The Flyweight Pattern Nik Reiman Joshua Hertz

2 Roadmap What is the Flyweight Pattern? UML When is Flyweight Useful? How to Use the Flyweight Pattern?

3 What is the Flyweight Pattern? As Defined By the Gang of 4 –Use Sharing to support large numbers of Fine-Grained objects efficiently. As Defined By Metsker –The Flyweight Pattern addresses sharing, relying on an objects ability to be responsible to more then one client.

4 A More Usable Definition Specifies a commonality among many objects Acts as independent object in each context Helps to share information among objects

5 UML Example

6 When is a Flyweight useful? Lots of small objects with a common inheritance –Word processor –Online book Independent central class

7 How to use Flyweight Extract the immutable part of central class Make this information static Provide this information to an arbitrary number of client objects

8 Example of Flyweight at Oozinoz (figure 13.2)

9 The Challenges The challenges are overly confusing (to us anyway). It’s worth your time to try them though.

10 Questions?


Download ppt "The Flyweight Pattern Nik Reiman Joshua Hertz. Roadmap What is the Flyweight Pattern? UML When is Flyweight Useful? How to Use the Flyweight Pattern?"

Similar presentations


Ads by Google