© Vaskaran Sarcar 2020
V. SarcarDesign Patterns in C#https://doi.org/10.1007/978-1-4842-6062-3_10

10. Flyweight Pattern

Vaskaran Sarcar1 
(1)
Garia, Kolkata, West Bengal, India
 

This chapter covers the Flyweight pattern.

GoF Definition

Use sharing to support large numbers of fine-grained objects efficiently.

Concept

This pattern may look simple, but if you do not identify the core concepts, the implementations may appear to be complex. Let’s start with a basic but detailed explanation before you implement this pattern.

Sometimes you need to handle lots of objects that are very similar but not exactly the same. The constraint is that you cannot create all of them to lessen resource and memory usage. The Flyweight pattern is made to handle these scenarios. ...

Get Design Patterns in C#: A Hands-on Guide with Real-world Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.