Solving Design Problems With Design Patterns
Solving Design Problems With Design Patterns
• Designing a system that is robust to changes is a rather hard task to do. However, a
design that doesn’t take changes into account risks major redesigns in the future.
Design patterns can ensure that a system can change in specific ways.
• Each design pattern lets some aspect of the system structure vary independently of
other aspects, thereby making a system more robust to a particular kind of change.
• Let us look on some examples:
• Creating an object by specifying a class explicitly commits to a particular
implementation instead of a particular interface. That means if we in the future want to
change the object that we use we need also to implement the client code again. On the
other hand using the design patterns, such as Abstract Factory pattern lets you avoid
this problem.
• Dependence on hardware and software platform. Clients that know how an object is
represented, stored, located, or implemented might need to be changed when the
object changes. Hiding this information from clients keeps changes from cascading. An
example is again Abstract Factory used to create different look-and-feel components
across different operating systems.
Guidelines for selecting a design
pattern