Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • SOLID Principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion)

  • DRY Principle (Don't Repeat Yourself)

  • KISS Principle (Keep It Simple, Stupid)

  • Composition over Inheritance

The Gang of Four:

The "Gang of Four" refers to four authors - Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides - who co-wrote the influential book "Design Patterns: Elements of Reusable Object-Oriented Software."

This book was published in 1994 and it identified, named, and described 23 classic software design patterns. The patterns are grouped into three categories: Creational, Structural, and Behavioral.

...

 

  1. Creational Patterns are about object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or in added complexity to the design. These patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly. Examples include the Singleton, Factory Method, and Abstract Factory patterns.

  2. Structural Patterns are about organizing different classes and objects to form larger structures and provide new functionality. These patterns help ensure that when one part of a system changes, the entire structure doesn't need to change along with it. Examples include the Adapter, Decorator, and Composite patterns.

  3. Behavioral Patterns are about identifying common communication patterns between objects and realizing these patterns. These patterns are specifically concerned with communication between objects. Examples include the Observer, Strategy, and Command patterns.

We will look at a few of the design patterns in this section.