Want more? Subscribe to my free newsletter:
Managing JavaScript Application Resources with the Flyweight Pattern
July 4, 2011
In design patterns, the flyweight is considered one of the most useful classical solutions for code that's repetitive, slow and inefficient - for example: situations where we might create large numbers of similar objects.
It's of particular use in JavaScript where code that's complex in nature may easily use all of the available memory, causing a number of performance issues - however it's been quite underused in recent years. Given how reliant we are on JavaScript for the applications of today, both performance and scalability are often paramount and this pattern (when applied correctly) can assist with improving both.