Look, Read, Understand, Apply


OOAD - Object Oriented Analysis and Design

GoF Design Patterns

Gang of Four (GoF) Design Patterns

Authors of GoF Design Patterns

  • Erich Gamma
  • Richard Helm
  • Ralph Johnson
  • John Vlissides
  • Name   Adapter
    Problem    In software development two different compatible interfaces have to work. How can two different incompatible interfaces can be made work together? For example, how VGA cable can be used with HDMI port
    Solution    Use intermediate adapter object to convert the original interface of a component into another expected interface
    Name   Factory
    Problem   Who should take responsibility of creating objects in case of special considerations like complex object creation logic?
    Solution   Create a Factory object for handling the object creation. Factory object is fabriacted object, it was not initially mentioned in the domain model.
    Name   Singleton
    Problem   Only one object is needed with global and single access point
    Solution   Create a class with static method that returns the object of that class
    Name   Observer
    Problem   How an object "A" can send message or notification about its own state change to other several objects which are interested to known about the change of state of object "A"?
    Solution   Create "subscriber" or listener interface which will be implemented by the Subscribers. Allow publisher "A" to dynamically register the subscribers who are interested in the state of the publisher "A" and notify then when there occurs change in the its own state.