11. Design Pattern: Flyweight
<p>It is one of the <strong>structural design patterns</strong> that is used to reduce the number of objects created to improve the <strong>memory footprint</strong> of an application. It is usually employed whenever we have limited memory or we can <strong>reuse the already existing similar kind</strong> of objects. It also helps in improving performance.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:640/0*D9CS6Ptv8DJAPD_R" style="height:400px; width:640px" /></p>
<p>Let’s take an example of an application where the Flyweight pattern can be applied to improve its memory footprint. <strong>Notepad++, A Text Editor</strong> which we want to implement. For simplicity, Assume we can write anything in the notepad++ using <code>A-Z</code>, <code>a-z</code>, and <code>0–9</code>, <code>space</code> characters.</p>
<p>A Client writes a paragraph using the mentioned characters. The same character would be repeating a couple of times. Can we create an object for those characters just once in the first use and reuse the same object in future uses?</p>
<p><a href="https://levelup.gitconnected.com/11-design-pattern-flyweight-bf3fbc41fa8c"><strong>Read More</strong></a></p>