Behavioral pattern
Encyclopedia
In software engineering
, behavioral design patterns are design pattern
s that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.
Examples of this type of design pattern include:
Software engineering
Software Engineering is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software, and the study of these approaches; that is, the application of engineering to software...
, behavioral design patterns are design pattern
Design pattern (computer science)
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that...
s that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.
Examples of this type of design pattern include:
- Chain of responsibility pattern: Command objects are handled or passed on to other objects by logic-containing processing objects
- Command patternCommand patternIn object-oriented programming, the command pattern is a design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time...
: Command objects encapsulate an action and its parameters - "Externalize the Stack": Turn a recursive function into an iterative one that uses a stack.
- Interpreter patternInterpreter patternIn computer programming, the interpreter pattern is a design pattern. The interpreter pattern specifies how to evaluate sentences in a language. The basic idea is to have a class for each symbol in a specialized computer language...
: Implement a specialized computer language to rapidly solve a specific set of problems - Iterator patternIterator patternIn object-oriented programming, the iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container's elements...
: Iterators are used to access the elements of an aggregate object sequentially without exposing its underlying representation - Mediator patternMediator patternThe mediator pattern, one of the 23 design patterns described in Design Patterns: Elements of Reusable Object-Oriented Software, provides a unified interface to a set of interfaces in a subsystem. This pattern is considered to be a behavioral pattern due to the way it can alter the program's...
: Provides a unified interface to a set of interfaces in a subsystem - Memento patternMemento patternThe memento pattern is a software design pattern that provides the ability to restore an object to its previous state .The memento pattern is implemented with two objects: the originator and a caretaker. The originator is some object that has an internal state. The caretaker is going to do...
: Provides the ability to restore an object to its previous state (rollback) - Null Object patternNull Object patternIn object-oriented computer programming, a Null Object is an object with defined neutral behavior. The Null Object design pattern describes the uses of such objects and their behavior . It was first published in the Pattern Languages of Program Design book series.-Motivation:In most...
: designed to act as a default value of an object - Observer patternObserver patternThe observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods...
: aka Publish/Subscribe or Event Listener. Objects register to observe an event which may be raised by another object- Weak reference pattern: De-couple an observer from an observable.
- Protocol stackProtocol stackThe protocol stack is an implementation of a computer networking protocol suite. The terms are often used interchangeably. Strictly speaking, the suite is the definition of the protocols, and the stack is the software implementation of them....
: Communications are handled by multiple layers, which form an encapsulation hierarchy. - State patternState patternThe state pattern, which closely resembles Strategy Pattern, is a behavioral software design pattern, also known as the objects for states pattern. This pattern is used in computer programming to represent the state of an object. This is a clean way for an object to partially change its type at...
: A clean way for an object to partially change its type at runtime - Strategy patternStrategy patternIn computer programming, the strategy pattern is a particular software design pattern, whereby algorithms can be selected at runtime. Formally speaking, the strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable...
: Algorithms can be selected on the fly - Specification patternSpecification patternIn computer programming, the specification pattern is a particular software design pattern, whereby business rules can be recombined by chaining the business rules together using boolean logic....
: Recombinable Business logic in a boolean fashion - Template method patternTemplate method patternIn software engineering, the template method pattern is a design pattern.It is a behavioral pattern, and is unrelated to C++ templates.-Introduction:A template method defines the program skeleton of an algorithm...
: Describes the program skeleton of a program - Visitor patternVisitor patternIn object-oriented programming and software engineering, the visitor design pattern is a way of separating an algorithm from an object structure on which it operates. A practical result of this separation is the ability to add new operations to existing object structures without modifying those...
: A way to separate an algorithm from an object - Single-serving visitor patternSingle-serving visitor patternIn computer programming, the single-serving visitor pattern is a design pattern. Its intent is to optimise the implementation of a visitor that is allocated, used only once, and then deleted .- Applicability :...
: Optimise the implementation of a visitor that is allocated, used only once, and then deleted - Hierarchical visitor patternHierarchical visitor patternIn software engineering, the hierarchical visitor pattern is one of design patterns that intend to provide a way to visit every node in the hierarchical data structure such as a tree.- External links :*...
: Provide a way to visit every node in a hierarchical data structureData structureIn computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...
such as a tree. - Scheduled-task patternScheduled-task patternA scheduled-task pattern is a type of software design pattern used with real-time systems. It is not to be confused with the "scheduler pattern"....
: A task is scheduled to be performed at a particular interval or clock time (used in real-time computingReal-time computingIn computer science, real-time computing , or reactive computing, is the study of hardware and software systems that are subject to a "real-time constraint"— e.g. operational deadlines from event to system response. Real-time programs must guarantee response within strict time constraints...
)