I was reading about the flyweight design pattern
on this page.
I was not able to understand the meaning of the "granularity" in the context of programming languages or the design pattern.
Can anyone please explain, an example would be great.
Granularity is a level of details. Granular objects are those, which are at low level detail in your program. Consider:
Usually you have many granular objects in application. If you will create separate object for each tree/character/seat/power-point it could be very memory-consuming. Thats the problem which is solved by Flyweight pattern.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With