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.
Combinator
Also known as Composition pattern Intent The functional pattern representing a style of organizing libraries centered around the idea of combining functions. Putting it simply, there is some type T, some functions for constructing “primitive” values of type T, and some “combinators” which can combine values of type T in various ways to build up more complex values of type T. Explanation Real world example In computer science, combinatory logic is used as a simplified model of computation, used in computability theory and proof theory.
Context object
Name / classification Context Object Also known as Context, Encapsulate Context Intent Decouple data from protocol-specific classes and store the scoped data in an object independent of the underlying protocol technology. Explanation Real-world example This application has different layers labelled A, B and C with each extracting specific information from a similar context for further use in the software. Passing down each pieces of information individually would be inefficient, a method to efficiently store and pass information is needed.
Converter
Intent The purpose of the Converter pattern is to provide a generic, common way of bidirectional conversion between corresponding types, allowing a clean implementation in which the types do not need to be aware of each other. Moreover, the Converter pattern introduces bidirectional collection mapping, reducing a boilerplate code to minimum. Explanation Real world example In real world applications it is often the case that database layer consists of entities that need to be mapped into DTOs for use on the business logic layer.
CQRS
Intent CQRS Command Query Responsibility Segregation - Separate the query side from the command side. Class diagram Applicability Use the CQRS pattern when You want to scale the queries and commands independently. You want to use different data models for queries and commands. Useful when dealing with complex domains. You want to use architectures like event sourcing or task based UI. Credits Greg Young - CQRS, Task Based UIs, Event Sourcing agh!
Currying
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.
Data Access Object
Intent Object provides an abstract interface to some type of database or other persistence mechanism. Explanation Real world example There’s a set of customers that need to be persisted to database. Additionally we need the whole set of CRUD (create/read/update/delete) operations so we can operate on customers easily. In plain words DAO is an interface we provide over the base persistence mechanism. Wikipedia says In computer software, a data access object (DAO) is a pattern that provides an abstract interface to some type of database or other persistence mechanism.
Data Bus
Intent Allows send of messages/events between components of an application without them needing to know about each other. They only need to know about the type of the message/event being sent. Explanation Real world example Say you have an app that enables online bookings and participation of events. You want the app to send notifications such as event advertisements to everyone who is an ordinary member of the community or organisation holding the events.
Data Mapper
Intent Data Mapper is the software layer that separates the in-memory objects from the database. Its responsibility is to transfer data between the objects and database and isolate them from each other. If we obtain a Data Mapper, it is not necessary for the in-memory object to know if the database exists or not. The user could directly manipulate the objects via Java command without having knowledge of SQL or database.
Data Transfer Object
Intent Pass data with multiple attributes in one shot from client to server, to avoid multiple calls to remote server. Explanation Real world example We need to fetch information about customers from remote database. Instead of querying the attributes one at a time, we use DTOs to transfer all the relevant attributes in a single shot. In plain words Using DTO relevant information can be fetched with a single backend query.
Dependency Injection
Intent Dependency Injection is a software design pattern in which one or more dependencies (or services) are injected, or passed by reference, into a dependent object (or client) and are made part of the client’s state. The pattern separates the creation of a client’s dependencies from its own behavior, which allows program designs to be loosely coupled and to follow the inversion of control and single responsibility principles. Explanation Real world example
Domain Model
Intent Domain model pattern provides an object-oriented way of dealing with complicated logic. Instead of having one procedure that handles all business logic for a user action there are multiple objects and each of them handles a slice of domain logic that is relevant to it. Explanation Real world example Let’s assume that we need to build an e-commerce web application. While analyzing requirements you will notice that there are few nouns you talk about repeatedly.