What is the difference between the Abstract Factory and Factory patterns?
- The Abstract Factory pattern is used to create objects without specifying the exact class of object that will be created, while the Factory pattern is used to provide an interface for creating families of related or dependent objects.
- The Abstract Factory pattern is used to create singleton objects, while the Factory pattern is used to create objects without specifying the exact class of object that will be created.
- The Abstract Factory pattern is used to provide a generic interface for creating objects, while the Factory pattern is used to provide a specific interface for creating objects.
- The Abstract Factory pattern is used to provide an interface for creating families of related or dependent objects, while the Factory pattern is used to create objects without specifying the exact class of object that will be created.
The Abstract Factory pattern is used to provide an interface for creating families of related or dependent objects, while the Factory pattern is used to create objects without specifying the exact class of object that will be created.
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 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 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 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 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.
When would you use the Builder Pattern? Why not just use a Factory Pattern?
- Use Builder Pattern when the construction process is complex with many options and Factory Pattern when the process is simple.
- Builder Pattern is used when you want to build objects step by step, while Factory Pattern is used when you need to create objects with a single method call.
- Use Builder Pattern when the number of object's attributes is large, while Factory Pattern is used when you need to hide the creation process.
- Builder Pattern is used when objects cannot be created in a single step, while Factory Pattern is used when the creation process is simple.
The Builder Pattern is used when the construction of an object is complex, and it allows you to build objects step by step, with each step having a different number of options. This is useful when you want to provide a clean API for creating objects, without exposing the details of the creation process. The Factory Pattern, on the other hand, is used when you need to create objects with a single method call. This is useful when the creation process is simple, and you don't need to provide a clean API for creating objects.
What is Business Delegate 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 reduces the coupling between presentation-tier clients and business services
- A design pattern that separates the business logic and presentation logic in an application
Business Delegate pattern provides a simplified interface to a set of services to reduce the coupling between presentation-tier clients and business services.
What is Adapter pattern?
- A design pattern that allows objects with incompatible interfaces to work together by converting the interface of one object into an interface expected by the client
- A design pattern that creates objects by cloning existing objects, rather than creating new instances from scratch
- A design pattern that creates objects in a step-by-step manner, allowing for more control over the object creation process
- A design pattern that promotes the loose coupling between objects, making the system easier to maintain and extend
Adapter pattern is a design pattern that allows objects with incompatible interfaces to work together by converting the interface of one object into an interface expected by the client. This pattern involves creating a wrapper class that implements the target interface and delegates calls to the adaptee object. The adapter acts as a bridge between the adaptee and client, allowing them to work together even if their interfaces are not compatible.
Is Repository Pattern as same as Active Record Pattern?
- No, the Repository Pattern is used for complex data access, while the Active Record Pattern is used for simple data access.
- No, the Repository Pattern is used for data access in multiple data sources, while the Active Record Pattern is used for data access in a single data source.
- No, the Repository Pattern provides an abstraction over the data access layer, while the Active Record Pattern combines the data access and business logic in a single object.
- Yes, the Repository Pattern and the Active Record Pattern are equivalent.
The Repository Pattern and the Active Record Pattern are different, as the Repository Pattern provides an abstraction over the data access layer, while the Active Record Pattern combines the data access and business logic in a single object.
What is Service Locator pattern?
- A behavioral pattern that describes how to distribute the communication between objects.
- A creational pattern that provides a way to create objects without specifying the exact class of object that will be created.
- A structural pattern that provides a centralized object registry and access to services by using a registry.
- An architectural pattern that separates an application into objects, implementing a user interface and interface communication.
The Service Locator pattern is a J2EE design pattern that abstracts the way to look up and access objects. The objects are managed in a registry, which can be queried for services by client objects.