Object-Oriented Design Flashcards
How to approach
Handle ambiguity (6 w’s but especially who and how).
Define the core objects
Analyze Relationships (which objects are members of which other objects? Do any objects inherit from any others? Are relationships many-to-many or one-to-many?)
Investigate Actions (key actions that objects will take and how they related to one another)
Singleton Class
Ensures that a class has only one instance and ensures access to the instance through the application. May be looked down on especially for unit testing.
Factory Method
Offers and interface for creating an instance of a class, with its subclasses deciding which class to instantiate. You may want to implement this with the creator class being abstract and not providing an implementation for the Factory method. Or, you could have the Creator class be a concrete class that provides an implementation for the Factory method. In this case, the Factory class would take a parameter representing which class to instantiate.