The blog I chose to talk about this week goes into detail about the flyweight design pattern using its applications and implementations. When the blog starts talking about the applications of the design pattern, it begins with the situations of when you should use this design pattern. It explains that flyweight is centered around memory and sharing which may not be an issue for today’s computers, but it still is prevalent within mobile phones. When there is a need to create many objects, that needs memory power to execute but this design pattern focuses on efficiently optimizing that memory sharing which helps boost performance. The application of this design is shown in the blog when it talks about the large number of objects being used by the system and how flyweight will group certain objects together to reuse code to make the entire problem less repetitive. The blog then goes on to talk about the intrinsic and extrinsic states which is explained through the types of data values the objects can hold. It explains how a concrete object may hold an intrinsic state as a value which allows that value to have certain properties. These properties can be extrinsic and be modified as needed.
I chose this article because as I read more about this flyweight design pattern, I realized it also had the possibility for factory implementation as well due to the efficiency with mass object creation. This really interested me since we just went over factories and I wanted some more experience in understanding how factories can be used in other patterns. Though it would just be used to test this design pattern, I thought it was good exposure to how they worked, and it worked well with explaining how flyweight worked. The content was easy to explain with the examples used that had written out code and UML diagrams. The blog used these resources together with JDK to produce an output based off a test class that emphasized the main points of the applications and implementations. They helped cement the idea of factories and code sharing between different objects very well and used similar concepts to those discussed in class. This would affect my future practice by allowing a new view on code reuse which is an important concept. This pattern taught me more about code efficiency using factories and different pattern concepts as well as the idea of objects having different modifiable properties.
From the blog CS@Worcester – Student To Scholar by kumarcomputerscience and used with permission of the author. All other rights reserved by the author.