Collection Pipeline
Intent Collection Pipeline introduces Function Composition and Collection Pipeline, two functional-style patterns that you can combine to iterate collections in your code. In functional programming, it’s common to sequence complex operations through a series of smaller modular functions or operations. The series is called a composition of functions, or a function composition. When a collection of data flows through a function composition, it becomes a collection pipeline. Function Composition and Collection Pipeline are two design patterns frequently used in functional-style programming.
Name / classification Currying Intent Currying decomposes a function that takes multiple arguments into a sequence of functions that each take a single argument. Curried functions are useful since they can be used to create new functions with lower arity to perform more specialised tasks in a concise and readable manner. This is done via partial application. Explanation Real-world example Consider a librarian who wants to populate their library with books.
Name / classification Filterer Intent The intent of this design pattern is to introduce a functional interface that will add a functionality for container-like objects to easily return filtered versions of themselves. Explanation Real world example We are designing a threat (malware) detection software which can analyze target systems for threats that are present in it. In the design we have to take into consideration that new Threat types can be added later.
Fluent Interface
Intent A fluent interface provides an easy-readable, flowing interface, that often mimics a domain specific language. Using this pattern results in code that can be read nearly as human language. Explanation The Fluent Interface pattern is useful when you want to provide an easy readable, flowing API. Those interfaces tend to mimic domain specific languages, so they can nearly be read as human languages. A fluent interface can be implemented using any of
Intent Monad pattern based on monad from linear algebra represents the way of chaining operations together step by step. Binding functions can be described as passing one’s output to another’s input basing on the ‘same type’ contract. Formally, monad consists of a type constructor M and two operations: bind - that takes monadic object and a function from plain object to monadic value and returns monadic value return - that takes plain type object and returns this object wrapped in a monadic value.