SOLID & Design Patterns Interview

Advanced Patterns, CQRS & Domain-Driven Design Fundamentals

Questions 51-75: Advanced Patterns, CQRS & Domain-Driven Design Fundamentals.

25 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

25 Results
51
Mid-LevelIntermediate

What is the Abstract Factory Pattern?

The Abstract Factory Pattern provides an interface for creating families of related or compatible objects without requiring client code to know their concrete classes. It is useful when several products must vary together.

52
Mid-LevelIntermediate

What is the difference between Factory Method and Abstract Factory?

Factory Method focuses on creating a product through a method whose concrete creation decision can vary. Abstract Factory exposes multiple creation operations for a family of related products.

53
Mid-LevelIntermediate

What is the difference between Factory and Builder?

A factory normally returns a complete object in one creation operation and hides which concrete implementation is instantiated. A builder focuses on constructing a complex object incrementally through a sequence of configuration steps.

54
Mid-LevelIntermediate

What is the Flyweight Pattern?

The Flyweight Pattern reduces memory usage by sharing common immutable state among many logical objects instead of duplicating that state in every instance. Instance-specific state is kept separately.

55
Mid-LevelIntermediate

What is the Bridge Pattern?

The Bridge Pattern separates an abstraction from its implementation so both can vary independently. Instead of creating a large inheritance hierarchy for every combination, the abstraction contains or receives an implementation object.

56
Mid-LevelIntermediate

What is the Composite Pattern?

The Composite Pattern represents individual objects and groups of objects through a common abstraction. Clients can therefore treat a single element and a collection of elements uniformly.

57
Mid-LevelIntermediate

What is the difference between Composite and Decorator?

Composite organizes objects into tree structures and allows individual objects and groups to be treated uniformly. Decorator wraps an object to add behavior while preserving its interface.

58
Mid-LevelIntermediate

What is the Interpreter Pattern?

The Interpreter Pattern defines a representation for a simple language or grammar and provides objects that interpret expressions in that language. It can be used for small rule languages, expressions, or domain-specific syntax.

59
Mid-LevelIntermediate

What is the difference between Strategy and State patterns?

Strategy and State can have similar class structures because both delegate behavior to interchangeable objects. Their intent differs: Strategy represents a chosen algorithm, while State represents behavior that changes as an object's internal state changes.

60
Mid-LevelIntermediate

What is the difference between Strategy and Template Method?

Strategy uses composition: an object delegates a variable algorithm to another object implementing a common abstraction. Template Method uses inheritance: a base class defines the algorithm structure and subclasses override selected steps.

61
Mid-LevelIntermediate

What is the difference between Decorator and Proxy?

Decorator adds responsibilities or behavior to an object while preserving its interface. Proxy primarily controls access to another object, for example through authorization, lazy initialization, remote communication, or access management.

62
Mid-LevelIntermediate

What is the difference between Facade and Mediator?

Facade provides a simpler interface for clients to access a complex subsystem. Mediator coordinates communication among peer components so those components do not need to reference each other directly.

63
Mid-LevelIntermediate

What is the CQRS pattern?

Command Query Responsibility Segregation separates operations that change state from operations that read state. Commands represent requested changes, while queries retrieve data without changing business state.

64
Mid-LevelIntermediate

What is the difference between a command and a query in CQRS?

A command requests a state-changing operation and normally expresses business intent, such as ApproveOrder or CancelBooking. A query requests information and should not change observable business state.

65
Mid-LevelIntermediate

Does CQRS require separate databases?

No. CQRS is fundamentally about separating command and query responsibilities. Both sides can use the same database while using different application models or handlers.

66
Mid-LevelIntermediate

What is the Mediator pattern's role in CQRS?

A mediator can dispatch command and query objects to their corresponding handlers, allowing controllers or endpoints to depend on a single request-dispatch abstraction instead of many handler classes.

67
Mid-LevelIntermediate

What is a pipeline behavior in mediator-based architectures?

A pipeline behavior wraps request handling with reusable logic before and after the actual handler. Typical concerns include validation, logging, performance measurement, authorization, and transaction management.

68
Mid-LevelIntermediate

What is Domain-Driven Design (DDD)?

Domain-Driven Design is an approach to software development that emphasizes modeling complex business domains using concepts and language shared by developers and domain experts. It includes strategic concepts such as bounded contexts and tactical patterns such as entities, value objects, aggregates, and domain services.

69
Mid-LevelIntermediate

What is an Entity in Domain-Driven Design?

An entity is a domain object defined primarily by its identity and lifecycle rather than only by its attribute values. Two entity instances can represent the same conceptual object if they have the same identity.

70
Mid-LevelIntermediate

What is a Value Object?

A Value Object represents a concept defined by its values rather than a unique identity. Value objects are usually immutable and compare structurally by their component values.

71
Mid-LevelIntermediate

What is an Aggregate in Domain-Driven Design?

An aggregate is a consistency boundary containing one or more domain objects that are treated as a unit for business changes. External code interacts with the aggregate through its root.

72
Mid-LevelIntermediate

What is an Aggregate Root?

An Aggregate Root is the entity that acts as the public entry point to an aggregate. Other objects outside the aggregate should normally reference and modify the aggregate through the root rather than changing internal entities directly.

73
Mid-LevelIntermediate

What is a Domain Service?

A Domain Service contains domain behavior that does not naturally belong to a single entity or value object. It expresses business logic using domain concepts and should remain focused on the domain rather than infrastructure concerns.

74
Mid-LevelIntermediate

What is a Domain Event?

A Domain Event represents something meaningful that has happened within the business domain, such as OrderConfirmed or PaymentReceived. It allows other parts of the application to react without placing every secondary action directly inside the originating entity.

75
Mid-LevelIntermediate

What is the difference between a Domain Event and an Integration Event?

A Domain Event represents an occurrence within a domain model and is often used for communication inside the same application or bounded context. An Integration Event is intended to communicate an occurrence across application, service, or bounded-context boundaries.