Skip to Content
Architectural Patterns
book

Architectural Patterns

by Anupama Murali, Pethuru Raj, Harihara Subramanian J, Pethuru Raj Chelliah
December 2017
Intermediate to advanced
468 pages
13h 12m
English
Packt Publishing
Content preview from Architectural Patterns

Flyweight

Flyweight suggests using the shared support of a vast number of fine-grained objects. We can use the Flyweight pattern to reduce the number of objects created (by sharing) and thereby reduce the memory footprint and improve the performance.

The preceding diagram depicts the general structure of the Flyweight pattern and a sample implementation. Consider a massive object that is shared across printer and a screen; Flyweight is a good option and can be cached as well (say for printing multiple copies).

Here are the benefits:

  • It leads to good performance due to reduction in the total number of instances (by shared objects)
  • It makes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Software Architecture Patterns

Software Architecture Patterns

Mark Richards
Design It!

Design It!

Michael Keeling

Publisher Resources

ISBN: 9781787287495Other