AI Features

Flyweight

This lesson discusses how the flyweight pattern can be applied to reduce memory requirements.

What is it ?

Flyweight is a category in boxing competitions for light weight boxers. The intent of the pattern is somewhat similar in that it tries to reduce bloated code to a more compact and lean representation, which uses less memory.

Formally, the pattern is defined as sharing state among a large number of fine-grained objects for efficiency.

Class Diagram

The class diagram consists of the following entities

  • Flyweight
  • Concrete Flyweight
  • Unshared Concrete Flyweight
  • Flyweight Factory
...