Skip to content
StackPractices

Tag: behavioral-patterns

Browse 8 practical software engineering resources tagged with "behavioral-patterns". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving behavioral-patterns.

Swap Algorithms at Runtime with the Strategy Pattern

How to encapsulate interchangeable algorithms and behaviors using the strategy pattern with dependency injection, function pointers, and lambda strategies in Java, TypeScript, and Python.

Chain of Responsibility for Request Processing Middleware

Pass requests along a chain of handlers where each handler decides whether to process the request or pass it to the next handler in the pipeline

Command Pattern with Undo/Redo in TypeScript

Implement the Command pattern to encapsulate requests as objects, enabling undo/redo operations, request queuing, and operation logging

Interpreter Pattern for Domain-Specific Expression Languages

Build a language interpreter that evaluates expressions and rules by representing grammar as composable objects, useful for formulas, queries, and business rules

Iterator Pattern for Custom Collection Traversal in

Provide a way to access elements of an aggregate object sequentially without exposing its underlying representation using the Iterator pattern

Mediator Pattern for Loose Component Coupling in

Reduce chaotic dependencies between UI components by introducing a mediator that centralizes communication, preventing explicit references between peers

Memento Pattern for State Snapshot and Restoration

Capture and externalize an object's internal state without violating encapsulation, enabling undo, serialization, and state rollback in applications

Visitor Pattern for Extensible Operations on Object

Separate algorithms from the objects they operate on, allowing new operations to be added without modifying existing element classes