- Purpose: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.
- Use Case: Creating sets of related objects, like UI components for different operating systems, without specifying concrete classes.
- Purpose: Allows incompatible interfaces to work together by wrapping itself around an object and exposing a standard interface to interact with that object.
- Use Case: Integrating new functionality or systems without changing existing code, like using a new API with an old system.
- Purpose: Encapsulates a request as an object, thereby allowing for parameterization of clients with different requests, queue or log requests, and support undoable operations.
- Use Case: Implementing things like menu actions, where actions can be triggered in various ways and undone.
- Purpose: Dynamically adds additional responsibilities to an object without modifying its structure.
- Use Case: Adding new features to objects without altering the class, such as GUI component enhancements.
- Purpose: Provides a simplified interface to a complex subsystem.
- Use Case: Simplifying the interaction with a complex library or API, like a set of network operations.
- Purpose: Defines an interface for creating an object but lets subclasses alter the type of objects that will be created.
- Use Case: Frameworks where library code needs to create objects but doesn't know the specific types.
- Purpose: Allows a set of observer objects to watch and react to events or changes in a subject object.
- Use Case: Implementing event handling systems, like UI event listeners.
- Purpose: Ensures a class has only one instance and provides a global point of access to it.
- Use Case: Managing a shared resource, such as a database connection.
- Purpose: Defines a family of algorithms, encapsulates each one, and makes them interchangeable, allowing the algorithm to vary independently from clients that use it.
- Use Case: Supporting multiple variations of an algorithm, such as different sorting or compression algorithms.
git clone https://github.com/Dikontay/Design-patterns-GOLANG.git
cd observerPattern/
go run .
cd .. && cd strategyPattern/
go run .