Understanding Design Patterns

"In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into source or machine code."

As an effort towards learning and documenting key findings, I will be sharing the design concepts as I move on:

Strategy Pattern: Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

Observer Pattern: Define a one-to-many dependency between objects where a state change in one object results in all its dependents being notified and updated automatically.

Decorator Pattern: Attach additional responsibilities to an object dynamically keeping the same interface. Decorators provide a flexible alternative to subclassing for extending functionality.

Design Principles:

  • Encapsulate what varies - Identify the aspects that vary and separate them from what remains the same
  • Favor Composition over Inheritance
  • Program to interfaces, not implementations
  • Strive for loosely coupled designs between objects that interact
  • Classes should be open for extension, but closed for modification.

--
Source:
en.wikipedia.org/wiki/Software_design_pattern
Head First Java

Technologies: