What is the purpose of the Command pattern?
- To allow objects to be treated as commands that can be executed, deferred or queued
- 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
The Command pattern allows objects to be treated as commands that can be executed, deferred or queued
What is Memento pattern?
- A design pattern that allows the client to traverse a collection of objects, without exposing the underlying representation of the collection
- A design pattern that captures the internal state of an object, allowing the object to be restored to this state later
- A design pattern that converts a request into a standalone object, allowing the client to parametrize objects with different requests, queue a request, or log requests
- A design pattern that provides a simplified interface to a complex system, allowing the client to interact with the system through a single, unified interface
The Memento pattern is a design pattern that captures the internal state of an object, allowing the object to be restored to this state later. The Memento pattern is used to capture and store the internal state of an object so that it can be restored at a later time, without violating the object's encapsulation. The Memento pattern is used to implement undo/redo functionality in applications.
What is the difference between the Decorator and Proxy patterns?
- None of the above
- The Decorator and Proxy patterns are the same
- The Decorator pattern adds behavior to an object dynamically, while the Proxy pattern provides a substitute for an object to control access to it
- The Decorator pattern provides a substitute for an object to control access to it, while the Proxy pattern adds behavior to an object dynamically
The Decorator pattern adds behavior to an object dynamically, while the Proxy pattern provides a substitute for an object to control access to it
What is Proxy pattern?
- A design pattern that allows objects to represent or act on behalf of other objects, providing a level of indirection between the client and the target object
- A design pattern that creates objects by cloning existing objects, rather than creating new instances from scratch
- A design pattern that provides a simplified interface to a complex system, allowing the client to interact with the system through a single, unified interface
- A design pattern that uses shared objects to support large numbers of similar objects efficiently
Proxy pattern is a design pattern that allows objects to represent or act on behalf of other objects, providing a level of indirection between the client and the target object. The pattern involves creating a proxy class that acts as an intermediary between the client and the target object. This pattern can be useful in situations where you want to add additional functionality or control access to an object, without affecting the behavior of the target object.
What is Composite Entity pattern?
- A design pattern that promotes loose coupling by keeping the presentation layer separate from the business layer
- A design pattern that provides a simplified interface to a set of services
- A design pattern that separates the business logic and presentation logic in an application
- A design pattern used to represent entities that have a tree structure
Composite Entity pattern is used to represent entities that have a tree structure, such as an organizational chart.
What is the purpose of the Null Object pattern?
- To encapsulate complex operations and make them simple to use
- To handle requests or operations from clients
- To provide a substitute for a null reference
- To separate the representation of an object from its behavior
The Null Object pattern provides an object as a substitute for a null reference, avoiding the need for checking for null values.
What is Decorator pattern?
- A design pattern that allows objects to be decorated with additional responsibilities, dynamically, at runtime
- A design pattern that creates objects by cloning existing objects, rather than creating new instances from scratch
- A design pattern that filters a set of objects based on certain criteria and returns a subset of those objects
- A design pattern that separates an object's implementation from its interface, allowing the two to vary independently
Decorator pattern is a design pattern that allows objects to be decorated with additional responsibilities, dynamically, at runtime. The pattern involves creating a decorator class that wraps the original object, adding the new responsibilities to the original object's behavior. This pattern can be useful in situations where you want to add or remove responsibilities from objects dynamically, without affecting the behavior of the original objects.
Explain usage of Service Locator Pattern
- The Service Locator pattern is used to access a centralized registry of service objects, so that client objects can access the services directly.
- The Service Locator pattern is used to access a centralized registry of service objects, so that client objects do not have to depend on the concrete implementations of the services.
- The Service Locator pattern is used to create a centralized registry of service objects, so that client objects can access the services indirectly.
- The Service Locator pattern is used to maintain a centralized registry of service objects, so that client objects can access the services through a locator object.
The Service Locator pattern is used to maintain a centralized registry of service objects, and provides a single point of access for clients to access the services through a locator object.
What is the difference between the Transfer Object and Data Access Object patterns?
- Transfer Object is a client-side pattern, while Data Access Object is a server-side pattern.
- Transfer Object is a simple object used to pass data between layers, while Data Access Object is used to perform CRUD operations on a database.
- Transfer Object is used to manage the lifecycle of objects, while Data Access Object is used to encapsulate complex business logic.
- Transfer Object is used to perform CRUD operations on a database, while Data Access Object is a simple object used to pass data between layers.
The Transfer Object pattern involves a simple object used to pass data between layers, while the Data Access Object pattern involves an object used to perform CRUD operations on a database.
What are some reasons to use Repository Pattern?
- To abstract data access and encapsulate underlying data storage
- To allow for code reuse
- To increase security by limiting direct access to the data storage
- To manage the complexity of a software system
Repository Pattern is used to abstract data access and encapsulate the underlying data storage, making it easier to change data storage solutions without affecting the rest of the application. It also helps to manage the complexity of a software system by providing a clear separation of concerns between the data access logic and the business logic.