RO EN
Visitor Pattern – new operations without modifying the structure of objects

Visitor Pattern – new operations without modifying the structure of objects

The Visitor Pattern allows adding new operations to a set of objects without modifying their classes. The logic is extracted into a separate "visitor," which knows how to act on each type of object. The pattern is ideal when the object structure is stable, but the operations on them change frequently.

Citește mai mult
Template Method Pattern – defining the skeleton of an algorithm

Template Method Pattern – defining the skeleton of an algorithm

The Template Method Pattern is a behavioral design pattern that defines the structure of an algorithm in a base class, allowing derived classes to customize specific steps without changing the overall flow. It is ideal for standardized processes and reusable code in .NET applications.

Citește mai mult
Strategy Pattern – replacing algorithms at runtime

Strategy Pattern – replacing algorithms at runtime

The Strategy Pattern allows the definition of multiple interchangeable algorithms, each encapsulated in a separate class. The context can change the strategy used at runtime, without modifying the client code, facilitating extensibility and adherence to the Open/Closed principle.

Citește mai mult
State Pattern – changing behavior based on state

State Pattern – changing behavior based on state

The State Pattern is a behavioral design pattern that allows an object to change its behavior when its internal state changes, without resorting to complex if or switch statements. By moving the logic specific to each state into separate classes, the code becomes cleaner, more extensible, and easier to maintain, making it ideal for C# applications with dynamic flows and variable rules.

Citește mai mult
Observer Pattern – reactive notifications between objects (event-driven)

Observer Pattern – reactive notifications between objects (event-driven)

The Observer Pattern allows objects to be automatically notified when the state of another object changes. It is the foundation of event-driven architectures, being ideal for reactive applications, dynamic UIs, and distributed systems.

Citește mai mult
Memento Pattern – saving and restoring the state of objects

Memento Pattern – saving and restoring the state of objects

The Memento Pattern is a behavioral design pattern that allows saving and restoring the state of an object without exposing its internal structure. It is the ideal solution for functionalities such as Undo / Redo, change history, and state snapshots in modern .NET applications.

Citește mai mult
Mediator Pattern – centralized communication between components

Mediator Pattern – centralized communication between components

Mediator Pattern is a behavioral design pattern that enables communication between components through a central object (mediator), reducing direct dependencies and increasing architectural clarity. In this article, you will see how the Mediator Pattern can be applied in a .NET (C#) application, including practical examples and real scenarios from modern applications (UI, business logic, DDD).

Citește mai mult
Iterator Pattern – traversing collections without exposing internals

Iterator Pattern – traversing collections without exposing internals

The Iterator Pattern allows traversing collections without exposing their internal structure. In this article, we discuss when and why to use Iterator, how it separates traversal logic from the collection, and how you can correctly implement it in C# for cleaner, more extensible, and testable code.

Citește mai mult