Aggregator Microservices
Intent The user makes a single call to the aggregator service, and the aggregator then calls each relevant microservice. Explanation Real world example Our web marketplace needs information about products and their current inventory. It makes a call to an aggregator service which in turn calls the product information microservice and product inventory microservice returning the combined information. In plain words Aggregator Microservice collects pieces of data from various microservices and returns an aggregate for processing.
API Gateway
Intent Aggregate calls to microservices in a single location, the API Gateway. The user makes a single call to the API Gateway, and the API Gateway then calls each relevant microservice. Explanation With the Microservices pattern, a client may need data from multiple different microservices. If the client called each microservice directly, that could contribute to longer load times, since the client would have to make a network request for each microservice called.
Client Session Pattern
Name Client Session pattern Intent Create stateless servers that removes the problem of clustering, as users can switch between servers seamlessly. Makes data more resilient in case of server fail-over. Works well with smaller data sizes. Explanation Real-World Example You’re looking to create a data management app allowing users to send requests to the server to modify and make changes to data stored on their devices. These requests are small in size and the data is individual to each user, negating the need for a large scale database implementation.
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!
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.
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.