Flyweight is a structural pattern that lets you fit more objects into available RAM by sharing common parts of state between multiple objects instead of keeping all of the data in each object. It separates object state into intrinsic (shared, immutable) and extrinsic (unique per object, passed in at use time). The shared intrinsic part is the Flyweight.
ℹ️Core idea: extract the repeated, immutable part of an object (intrinsic state) into a shared Flyweight. Pass the unique, context-dependent part (extrinsic state) to the Flyweight's methods at runtime.
Content is available with subscription.
Get full access to all courses on the platform for one year with a single payment.
▼
Unlike other platforms that charge per course, here you get everything for one price, and after one year of use there will be no automatic charge for the following year.