There are seven popular
design patterns which you are liable to encounter.
In this module, we are going to concentrate on the Flyweight pattern, and incorporate it into the course project. The other six common structural patterns are described in the SlideShow below:
||Extends the functionality of an object in a manner that is transparent to its clients without using inheritance.
||Allows the conversion of the interface of a class to another interface that clients expect. This allows classes with incompatible interfaces to work together.
|Chain of Responsibility:
||Avoids coupling a (request) sender object to a receiver object. Allows a sender object to pass its request along a chain of objects without knowing which object will actually handle the request.
||Provides a higher-level interface to a subsystem of classes, making the subsystem easier to use.
||Allows a separate object to be used as a substitute to provide controlled access to an object that is not accessible by normal means.
||Allows the separation of an abstract interface from its implementation. This eliminates the dependency between the two, allowing them to be modified independently.
|Virtual Proxy Facilitates:
||The mechanism for delaying the creation of an object until it is actually needed in a manner that is transparent to its client objects.
||When there is a need to perform supplemental operations such as logging and counting before or after a method call on an object, recommends encapsulating the supplemental functionality into a separate object.
||Recommends that when an aggregate object is instantiated, all of its member variables representing the set of constituting objects must also be initialized. In other words, whenever an aggregate object is instantiated it must be constructed in full.
|Explicit Object Release:
||Recommends that when an object goes out of scope, all of the system resources tied up with that object must be released in a timely manner.
||Cache Stores the results of a method call on an object in a repository. When client objects invoke the same method, instead of accessing the actual object, results are returned to the client object from the repository. This is done mainly to achieve a faster response time.
These patterns use the same basic techniques to form their structures, so they look somewhat similar on the face of it.
Howwever, most of these patterns solve different problems, and in general the problem you face determines which pattern you choose.