What is Factory pattern?

  • A design pattern used to create objects in a more efficient way
  • A design pattern used to manage the dependencies between objects
  • A design pattern used to manage the lifecycle of objects
  • A design pattern used to manage the relationships between objects
The Factory pattern is a creational design pattern that provides a way to create objects in a more efficient and centralized manner. The Factory pattern abstracts the process of object creation and allows the client code to be decoupled from the actual implementation of the objects being created. This allows for greater flexibility and maintainability in the code, as the specific implementation of the objects can be changed without affecting the client code.

What is Facade pattern?

  • A design pattern that allows objects to be decorated with additional responsibilities, dynamically, at runtime
  • A design pattern that filters a set of objects based on certain criteria and returns a subset of those objects
  • 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 separates an object's implementation from its interface, allowing the two to vary independently
Facade pattern is 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 pattern involves creating a facade class that acts as a wrapper around the complex system, providing a simplified interface to the client. This pattern can be useful in situations where you want to simplify the interface of a complex system, making it easier for clients to use the system.

What is the purpose of the Command pattern?

  • To allow for loose coupling between the sender of a request and its receivers.
  • To allow sending requests to objects without knowing anything about the operation being requested or the receiver of the request.
  • To convert the interface of a class into another interface clients expect.
  • To provide a unified interface to a set of interfaces in a subsystem.
The Command pattern is used to allow sending requests to objects without knowing anything about the operation being requested or the receiver of the request. It provides a way to queue or log requests and acts as a marshal between the sender and the receiver.

What will you choose: Repository Pattern or "smart" business objects?

  • It depends on the complexity of the project, but in general "smart" business objects is a better choice as it allows for easier management of business logic.
  • It depends on the requirements of the project, but in general Repository Pattern is a better choice as it provides separation of concerns between the data access and business logic.
  • It depends on the size of the project, but in general "smart" business objects is a better choice as it reduces the number of classes needed.
  • It depends on the team's experience, but in general Repository Pattern is a better choice as it provides a common interface for data access.
The choice between Repository Pattern and "smart" business objects depends on the specific requirements of the project, but in general the Repository Pattern provides better separation of concerns and a common interface for data access.

What is State pattern?

  • A design pattern in which an object, called the composite, is composed of one-to-many other objects, in a tree-like structure, allowing the client to interact with individual objects and compositions of objects uniformly
  • A design pattern in which an object, called the context, holds a reference to an instance of one of several possible concrete state objects, each of which represents a distinct state of the context and implements a common state interface
  • A design pattern in which an object, called the decorator, adds or overrides behavior of an existing object, dynamically
  • A design pattern in which an object, called the prototype, is used as a template to create new objects, without specifying their concrete classes
The State pattern is a design pattern in which an object, called the context, holds a reference to an instance of one of several possible concrete state objects, each of which represents a distinct state of the context and implements a common state interface. The State pattern allows the context's behavior to be altered dynamically by changing its state. The State pattern is used to implement state machines, allowing an object's behavior to be altered as its internal state changes.

What are the difference between a Static class and a Singleton class?

  • A Static class can have instance methods and properties, while a Singleton class can only have static methods and properties.
  • A Static class can have multiple instances, while a Singleton class can have only one instance.
  • A Static class does not maintain state, while a Singleton class maintains state for a single instance.
  • A Static class is a class that cannot be instantiated, while a Singleton class can be instantiated only once.
A Static class is a class that cannot be instantiated and can only have static members. It is a sealed class, which means it cannot be inherited. A Singleton class is a design pattern that ensures a class has only one instance while providing a global point of access to this instance. It uses a private constructor and a static instance variable to ensure that only one instance can be created. Unlike a Static class, a Singleton class can have both static and instance members.

Describe what is the Event Sourcing Pattern

  • A database pattern that tracks changes to data over time.
  • A design pattern that stores the history of an object's state changes.
  • A pattern used to store events in a database.
  • An architectural pattern that saves every state change of an application as an event.
Event Sourcing is a way of modeling the state changes of an application as a sequence of events, allowing us to persist these events as they occur. The events are stored in an event store, and can be used to reconstruct the state of the application at any point in time.

What is the purpose of the Template pattern?

  • To create complex objects step by step, using a builder object to abstract the process of creating the object
  • To define the basic steps of an algorithm and allow subclasses to provide concrete implementations for these steps
  • 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 Template pattern defines the basic steps of an algorithm and allows subclasses to provide concrete implementations for these steps

What is the purpose of the Adapter pattern?

  • To allow for loose coupling between the sender of a request and its receivers.
  • To convert the interface of a class into another interface clients expect.
  • To create objects based on a blueprint.
  • To provide a unified interface to a set of interfaces in a subsystem.
The Adapter pattern is used to convert the interface of a class into another interface clients expect, allowing classes to work together that couldn't otherwise because of incompatible interfaces.

How is Bridge pattern different from Adapter pattern?

  • The Bridge pattern aims to change the interface of an object while the Adapter pattern aims to reuse an existing object.
  • The Bridge pattern allows for multiple inheritance while the Adapter pattern only allows for single inheritance.
  • The Bridge pattern decouples an abstraction from its implementation while the Adapter pattern modifies the interface of an existing class to a client class.
  • The Bridge pattern is a structural pattern while the Adapter pattern is a behavioral pattern.
The Bridge pattern decouples an abstraction from its implementation while the Adapter pattern modifies the interface of an existing class to a client class.