O'Reilly logo

Apex Design Patterns by Anshul Verma, Jitendra Zaa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The flyweight pattern

It is always recommended that you design code with a memory-efficient approach to ensure that the memory footprint of the code is lean, and hence, less likely to clog the system. In the case of the Salesforce platform, it is extremely important as Salesforce imposes various limits, such as governor limits, feature limits, and so on. So, it is advisable to keep track of resource consumption.

The flyweight pattern was initially coined and used by Paul Calder and Mark Linton in relation to the What-You-See-Is-What-You-Get (WYSIWYG) visual editor development. As Graphical User Interface (GUI) applications are memory intensive, the flyweight pattern was used to handle memory efficiently.

The flyweight pattern helps reduce the memory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required