Five Patterns
The software architecture patterns have including the five patterns with details and they should be given below…
1. Layered Pattern:
The layered patterns are one of the most well define software architecture patterns. The various developer is used and without know the name. However, each layer has its owns responsibility and provide high layer services.
There are not predefine the number of layers.
- Presentation layer
- Business Layer
- Application layer
- Data access layer
- Database layer
The user initiates some piece of the code in the presentation layer that has been performing some action.so the presentation then called the underlying layer for the example application layer. Next, we go to the business layer and data access layer to store everything in the database.
Diagram: Layers
2. Layer Responsibility:
In the five patterns of the software architecture, each layer has its responsibility. So the presentation layer has contained the graphic design of applications and the user interaction and logic are not specific in this layer. In the business layer, you should put the logic and user interaction and module that are specific to solve the business problem.
This application is the middle of the business layer and the presentation layer. On the one hand, the presentation layer did not know the business layer. In the application layer, you cannot change the technology stack theory without changing anything. For example, changing form WPF TO WinForms.
On the second hand so the application layer should provide the place to put the logic and does not fit it into the presentation and business layers.
Advantages:
- Testable application and well-organization.
- The pattern is familiar with most developers.
Disadvantage:
- Developer fined a lot of codes that are writing to pass through the different layers without adding any value to the layer.
- The monolithic application is hard to split up afterward.
3. Microkernel:
The microkernel provides the entering point and general flow of the application.
For example:
A task scheduler the microkernel that contains the logic for the trigger and scheduler task. So the plugin contains the specific tasks. The microkernel is triggered by them and without knowledge, they need the details of implementation. Similarly, another example is the workflow.
Advantages:
- Provide extensibility and flexibility.
- While the application is running some implementation is allowed to add the plugin.
- Develop the separate teams for microkernel and plugin.
Disadvantage:
- Difficult to decide what does not and what belongs to the microkernel.
- Predefine the API.
- Workflow
4. CQRS:
CQRS stands for the command and query responsibility segregation. The central concept of the patterns has read and written the operation that is separated. It means the model is used to write the operation will differ from the read model. However, the data are stored in the location they provide. Some implementation is stored in a different model and a different database. The CQRS has been storing the current state of your model in the database.
For example, SQL Server for the command model and MongoDB for the read model.
When the user can perform some action them the application sends the commands to the command service and the command service the has been retrieving any data that is needed for the command database and also making the stores and necessary manipulations back in the database and then read the service notifies so that update the read model.
Advantages:
- The Command models that can be focused on the logic and validation while reading and the models be tailored to a specific scenario.
- Avoid complex queries.
Disadvantages:
- Keeping the command
- Sync the read model become complex
5. Event Sourcing:
While the event sourcing is similar to the CQRS but little difference between them. The event sourcing does not store the current state of your model in the database but rather the event also happens in the model. In the event sourcing when the value of the customer has changed them, they would not be the store the value in a name column.
Advantages:
- Provide the adult log out of the box.
- Each event represents the manipulated data at a certain point in
Disadvantages:
- You cannot fix the wrong data with the simple edit in the database because some discipline is
- Change the structure of the event.
Microservices:
In which the process of the microservices when you write the application has a set of the microservice and also multiple application that is working together and each microservice has its responsibilities and developed the independent team of other microservice. So the microservice has been communicating with each other and you will sure to send the message among the remain backward compatible.
Advantages:
- Deploy, write and maintain each separate microservice.
- It should be easier to scale.
- No need the scale to less frequently used the pieces of the application
Disadvantages:
- A single user can pass through the multiple microservices
- The team misses the necessary skill to write a good structure for the monolith probably has a hard time.