part four

Part 4 Design patterns solve application architecture problems

 

Design patterns take our object-oriented software design skills up to the next level. They are models from which we can create well-designed solutions to many common software architecture problems. Software architecture refers to how we structure the code of our application — the classes and subclasses we design and how they relate to one another and interact at run time. Developers over many years across different industries have proven that these patterns model solutions that are reliable, flexible, and adhere to good design principles.

Some example architecture problems that design patterns can help solve:

  • An application uses a family of algorithms. Can we encapsulate each algorithm and make them interchangeable?
  • An application needs to create different sets of objects. These objects can be organized into several categories or families. Can be flexible about object creation but not mix up objects from different families?
  • An application manages several different sequences of objects. Can the application process the objects one at a time from a sequence without needing to know how any of the sequences are implemented?
  • One object of the application produces a stream of data at run time that other objects of the application consume. Can we design the application so that the producer doesn’t need to know who the consumers are or what each consumer does with the data, and be able to add or remove consumers at run time?

The benefits of design patterns

Explaining the design patterns

The sports examples