Design patterns are guidelines for solving common problems in software development. By learning design patterns, you can quickly and easily communicate designs to other software developers.
A few common design patterns include the following:
Strategy Pattern
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Instead of inheriting behavior, it is created.
Observer Pattern
The Observer Pattern is the most commonly used design pattern in the real world. It defines a one-to-many dependency between objects so that when one object changes its state, all of its dependents are notified and updated automatically.
Decorator Pattern
The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
Singleton Pattern
The Singleton PatternĀ ensures that a class has only one instance, and provides a global access point to it.
State Pattern
The State Pattern uses a set of state constants, and uses a variable to hold the current state. The pattern encapsulates state into separate classes.
Collection Pattern
The Collection Pattern provides a way to access the elements of an aggregate object without exposing its underlying representation.