What is Gang of Four (GOF)?

  • A group of four software design experts, namely Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, who wrote a book titled "Design Patterns: Elements of Reusable Object-Oriented Software".
  • A group of software design experts who provide consulting services on software design.
  • A group of software developers who work together on software development projects.
  • A software development company that specializes in creating design patterns.
The Gang of Four (GOF) is a group of four software design experts who wrote a seminal book on design patterns. The book, which was published in 1995, popularized the concept of design patterns and provided a common vocabulary and a standard way of thinking about software design problems. The GOF book is considered an essential reference for software developers and is widely used in the software development community.

What is the Chain of Responsibility pattern?

  • The Chain of Responsibility pattern is a design pattern that allows multiple objects to handle a request one by one, until one of them handles it successfully.
  • The Chain of Responsibility pattern is a design pattern that allows objects to be chained together, so that when a request is made, it can be passed from one object to the next, until it is handled.
  • The Chain of Responsibility pattern is a design pattern that allows objects to be linked together, so that a request can be passed from one object to another, until it is handled.
  • The Chain of Responsibility pattern is a design pattern that uses a set of objects to handle a request, without specifying the receiver.
The Chain of Responsibility pattern is a behavioral design pattern that involves passing a request sequentially through a dynamic list of objects until one of them handles it. The objects become a chain of receivers, and the request is sent from one object to another, until it is handled. This allows for a greater level of decoupling between the objects, making it easier to modify or extend the system.

What is Builder pattern?

  • A design pattern that allows the creation of objects without specifying the exact class of object that will be created
  • A design pattern that helps to create objects in a step-by-step manner, allowing for more control over the object creation process
  • A design pattern that helps to reduce the number of objects in the system, making it more efficient
  • A design pattern that promotes the loose coupling between objects, making the system easier to maintain and extend
Builder pattern is a design pattern that helps to create objects in a step-by-step manner, allowing for more control over the object creation process. This pattern separates the construction of a complex object from its representation, allowing for the same construction process to create different representations.

How should I be grouping my Repositories when using Repository Pattern?

  • Repositories should be grouped based on the database tables they access, for example grouping all repositories that access a specific table in a single class or namespace.
  • Repositories should be grouped based on the domain entities they provide access to, for example grouping all repositories for a specific type of entity in a single class or namespace.
  • Repositories should be grouped based on the type of operations they support, for example grouping all repositories that support read operations in a single class or namespace.
  • Repositories should be grouped based on their implementation, for example grouping all repositories that use a specific data access technology in a single class or namespace.
Repositories should be grouped based on the domain entities they provide access to, as this provides a clear and organized way of grouping related repositories.

What is the purpose of the Business Delegate pattern?

  • To create objects with complex behavior.
  • To define a default behavior for an object.
  • To encapsulate business logic and provide a clean API for clients.
  • To manage the lifecycle of objects.
The Business Delegate pattern aims to encapsulate complex business logic and provide a clean API for clients to access it, reducing coupling between the client and business logic.

Name the actor classes used in Observer pattern.

  • ConcreteObserver, Subject, Observer
  • Observer, ConcreteObserver, Subject
  • Subject, Observer, ConcreteObserver
  • Subject, Observer, ConcreteSubject
The actor classes used in the Observer pattern are: Subject, Observer, and ConcreteObserver. The Subject class is responsible for maintaining a list of its dependents and notifying them of changes to its state. The Observer class is an abstract class that defines the interface for updating dependents. The ConcreteObserver class is a concrete implementation of the Observer class, responsible for updating its state in response to changes to the subject's state.

What is the difference between the Strategy and Template patterns?

  • The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. The Template pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses.
  • The Strategy pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses, while the Template pattern defines a family of algorithms and makes them interchangeable.
  • The Template pattern is used to allow for loose coupling between the sender of a request and its receivers, while the Strategy pattern provides a unified interface to a set of interfaces in a subsystem.
  • The Template pattern is used to convert the interface of a class into another interface clients expect, while the Strategy pattern allows sending requests to objects without knowing anything about the operation being requested or the receiver of the request.
The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable, while the Template pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses.

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.