GoF Patterns Problems/Solutions

Software Development 21 Comments »

These are the basic descriptions of some GoF patterns.

Name: Adapter
Problem: How do you resolve incompatible interfaces, or provide a stable interface to similar components with different interfaces?
Solution: Convert the original interface of a component into another interface, through an intermediate adapter object. Read the rest of this entry »

GoF: Singleton

Software Development No Comments »

When we implement Factory pattern, we ask ourselves, how many objects of Factory should there be? The answer is simple; there should be only one object. So how do we mandate only one creation of this object? This is where the Singleton pattern of the Gang of Four comes in. Singleton pattern ensures that only one instance of a class is made. We achieve this by having an instance variable of a Factory type within the same Factory class. We then make the constructor private, and then create a static method that returns this object.
Read the rest of this entry »

Forever Excitified
 
web statistics