Junior — Middle
Can you list the main design patterns and describe their purpose?
sobes.tech AI
Answer from AI
Main design patterns and their purposes:
- Singleton: Ensures a class has only one instance and provides a global point of access.
- Observer: Allows objects to subscribe to events of another object and receive notifications.
- Factory Method: Defines an interface for creating an object but lets subclasses decide which class to instantiate.
- Decorator: Dynamically adds responsibilities to objects by wrapping them.
- MVC (Model-View-Controller): Separates application into data, presentation, and control logic for easier maintenance and extension.
These patterns help create flexible, extendable, and maintainable application architectures.