An open API service indexing awesome lists of open source software.

https://github.com/khaledsawan/design-patterns

The Singleton, Factory Method, Adapter, Composite, and Observer design patterns are all demonstrated together.
https://github.com/khaledsawan/design-patterns

adapter-pattern composite-pattern design-patterns factory-method-pattern java observer-pattern singleton-pattern

Last synced: 4 months ago
JSON representation

The Singleton, Factory Method, Adapter, Composite, and Observer design patterns are all demonstrated together.

Awesome Lists containing this project

README

        

# design-patterns
## The Singleton, Factory Method, Adapter, Composite, and Observer design patterns are all demonstrated together.

- **Singleton** ensures that there is only one instance of the Singleton class.

- **Factory Method** is used to create objects based on a common interface.

- **Adapter** allows the `AdapterLegacySystem` to adapt the legacy system's interface to the Product interface.

- **Composite** represents a part-whole hierarchy with Component, Leaf, and Composite classes.

- **Observer** defines a one-to-many relationship between the Subject and multiple Observer objects.

This example showcases the integration of these design patterns into a single application, illustrating how they can work together in a cohesive manner.