Explain what is Composition over Inheritance?
- Composition over Inheritance is a design principle that eliminates the use of composition for code reuse.
- Composition over Inheritance is a design principle that eliminates the use of inheritance for code reuse.
- Composition over Inheritance is a design principle that favors class inheritance over object composition for code reuse.
- Composition over Inheritance is a design principle that favors object composition over class inheritance for code reuse.
Composition over Inheritance is a design principle that favors object composition over class inheritance for code reuse. It allows for greater flexibility and maintainability in code design.
What is the difference between the Factory and Abstract Factory patterns?
- None of the above
- The Factory and Abstract Factory patterns are the same
- The Factory pattern creates objects of a single class, while the Abstract Factory pattern creates objects of several classes
- The Factory pattern creates objects of several classes, while the Abstract Factory pattern creates objects of a single class
The Factory pattern creates objects of a single class, while the Abstract Factory pattern creates objects of several classes
What is Data Access Object (DAO) pattern?
- A design pattern to handle communication between objects
- A design pattern to handle the database connections
- A design pattern to manage complex state transitions
- A design pattern to provide a unified interface to a set of interfaces
The DAO pattern provides a unified interface to a set of data sources. It separates the data persistence mechanism from the business logic, allowing the data to be accessed and modified easily and efficiently.
What is the difference between the Singleton and Prototype patterns?
- The Singleton pattern allows multiple instances to be created from a single prototype object, while the Prototype pattern ensures that a class has only one instance and provides a global point of access to that instance.
- The Singleton pattern ensures that a class has multiple instances, while the Prototype pattern allows only one instance to be created from a single prototype object.
- The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance, while the Prototype pattern allows multiple instances to be created from a single prototype object.
- The Singleton pattern ensures that a class has only one instance, while the Prototype pattern ensures that a class has multiple instances with unique characteristics.
The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance, while the Prototype pattern allows multiple instances to be created from a single prototype object.
What is the purpose of the Chain of Responsibility pattern?
- To create complex objects step by step, using a builder object to abstract the process of creating the object
- To provide a common interface for a group of related classes
- To provide a simplified interface to a complex system, hiding the complexity of the system behind a single interface
- To provide a way to pass requests along a dynamic chain of receivers until one of them handles the request
The Chain of Responsibility pattern provides a way to pass requests along a dynamic chain of receivers until one of them handles the request