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:
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Instead of inheriting behavior, it is created.
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.
The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
The Singleton Pattern ensures that a class has only one instance, and provides a global access point to it.
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.
The Collection Pattern provides a way to access the elements of an aggregate object without exposing its underlying representation.