Behavior patterns (software)
The behavior patterns ( English behavioral design patterns ) in the software development are design patterns , model the complex behavior of the software. This increases the flexibility of the software in terms of its behavior.
Some behavior patterns are usually implemented with both object-oriented and dynamic and functional programming languages, others usually only with the latter.
Representative
The behavior patterns can be divided into different groups. A distinction is made between the functional behavior patterns, for example, state patterns, data building patterns and flow control patterns.
- Accumulator
- Patterns for functions that take a large amount of inputs and produce small (scalar) outputs, such as: B. Lazy evaluated sequences and reduce functions. Accumulator is a data building pattern.
- Observers (English pattern observer )
- Is a type of publish / subscribe or event watcher. Objects or functions register to recognize an event that could have been generated by another object. The functional variant essentially corresponds to the object-oriented version. In functional programming, the observer behavior pattern is a flow control pattern.
- Visitors (English pattern visitor )
- Is a way to separate an algorithm from an object.
- Consequences
- Each event can trigger multiple events. Generated events can cause changes in the state, so Consequences is a state pattern
- One-time visitor (English single-serving visitor pattern )
- Object that implements a one-time user of a system that is created, used once and then deleted.
- Hierarchical visitor
- Provides a way of using a hierarchical data structure such as B. a tree to reach every node .
- interpreter
- Implements a special programming language to quickly solve a specific set of problems.
- Iterator
- Iterators are used to access elements of an aggregated object .
- Command (English command pattern )
- Command objects encapsulate an action with their parameters.
- MapReduce
- A reduction of linear structures. MapReduce is a data building model.
- Memento
- Provides the ability to restore an object to a previous state ( rollback ).
- Zero object
- Used as a default value for an object.
- Scheduled activity (English scheduled-task pattern )
- An activity is planned in such a way that it takes place at a certain interval or (in real-time systems ) at a certain time.
- Protocol stack
- Communication is carried out over several layers that form a data encapsulation hierarchy.
- Reduce / Combine
- A reduction of tree-like structures. Reduce / Combine is a data building pattern.
- Recursive expansion
- Recursive expansion is a data building pattern.
- Reservation (English Reservation )
- A resource is reserved for a certain time. An example is a shopping cart in which an item added to a user's shopping cart is reserved for a period of time. If the payment process is not completed within the specified time, the object is released again for other users.
- Template Method (English template pattern method )
- Describes the framework of a program
- Weak reference (English weak reference pattern )
- Similar to the observer design pattern, decouples an observer from an observable one .
- pipeline
- A process with a single path of execution that is broken down into several discrete steps, each step delivering a similarly shaped result. Pipeline is a flow control pattern.
- Specification (English specification pattern )
- Recombinable business logic in a boolean way.
- Stapelveräußerlichung (English externalize the stack )
- Turns a recursive function into an iterative that uses the stack .
- State / Event
- Restores any previous status by reducing over stored events. State / Event is a state pattern
- Strategy (English strategy pattern )
- Used to select different, mostly complex algorithms at runtime.
- Token
- Is used to cancel and undo an operation, whereby the operation itself does not have a specific (named) identity. Token is a flow control pattern.
- Intermediaries (English pattern mediator )
- Provides a uniform interface for a set of interfaces in a subsystem.
- Wrapper
- A process with multiple discrete steps and a single main execution path, but with possible branch execution at each step. This pattern must not be confused with the adapter design pattern in object-oriented programming languages, which is often called a wrapper . Adapter is a flow control pattern.
- State (English state pattern )
- Is a clean way for an object to partially change its type at runtime.
- Chain of Responsibility (English chain of responsibility pattern )
- Command objects are processed by logic-containing processing objects or passed to other objects.
- Fuse (English circuit breaker )
- If there is an accumulation of access errors to a resource, for example due to overload, access to this resource is prevented for a time.
- Post / Redirect / Get
- Prevents double POST requests from web applications.
See also
swell
- ↑ a b c d e f g h i j k l Erich Gamma , Richard Helm , Ralph E. Johnson , John Vlissides : Design pattern . Elements of reusable object-oriented software. Addison-Wesley, Munich 2004, ISBN 3-8273-2199-9 (English: Design Patterns. Elements of Reusable Object-Oriented Software. ).
- ^ Peter Norvig : Design Patterns in Dynamic Languages. (PDF, PPT,) March 17, 1998, accessed April 6, 2013 .
- ↑ a b c d e f g h i j k Stuart Sierra: Functional Design Patterns. InfoQ, April 3, 2013, accessed April 6, 2013 .
- ^ Protocol stack. Retrieved July 2, 2013 .
- ↑ Arnon Rotem-Gal-Oz: Reservation. In: Cirrus Minor. Retrieved October 1, 2014 .
- ↑ Ashod Nakashian: Weak Reference Pattern. Retrieved July 2, 2013 .
- ^ Externalize The Stack. Retrieved July 2, 2013 .