laitimes

Decipher 5 software architecture patterns

Author | Orkhan Huseynli

Translated by | Sambodhi

Planning | Xin Xiaoliang

When someone starts to venture into software engineering, one day he will need to learn the basics of software architecture patterns. When I first came into programming, I didn't know how to understand the existing architectural model so that it wasn't too exhaustive and confusing, but very abstract and simple to understand.

This problem persisted even before I discovered Mark Richards' book Software Architecture Patterns. Here, I will share with you the most important parts of the book and the architectural patterns. (To learn more, I highly recommend reading this book or his report https://www.oreilly.com/content/software-architecture-patterns/)

1

Why, as a software engineer, should you learn at least basic architectural patterns?

I'm sure there are many articles that can answer this question, but I'll tell you some why. First, if you understand schema patterns, it will be easier for you to follow the architect's requirements. Second, understanding these patterns can help you make decisions in your code: for example, if your application design is based on event-driven microservices, as a software engineer, if you notice the increased complexity and responsibility of logic in an existing service, you must decouple your code into a separate service. (If you don't understand, just follow the content of the text, this pattern has been briefly explained in this article.) )

In his book, Mark Richards describes 5 modes:

Hierarchical architecture

Driver architecture

Microkernel architecture (or plug-in architecture)

Microservices architecture

Space-based architecture (or cloud architecture pattern)

1. Hierarchical architecture

It is the most common architecture for monolithic applications. The basic idea of this pattern is to divide the logic of the application into layers, each of which encapsulates a specific role. For example, the persistence layer will be responsible for communication between the application and the database engine.

Decipher 5 software architecture patterns

Figure 1: Hierarchical architecture pattern

2. Event-driven architecture

The idea behind this pattern is to decouple application logic into a single-purpose event-processing component that receives and processes events asynchronously. This is a popular distributed asynchronous architecture model that is known for its high scalability and adaptability.

Decipher 5 software architecture patterns

Figure 2: Event-driven architecture proxy topology

3. Microkernel architecture

Microkernel architecture, also known as plug-in architecture, consists of two major design patterns: the core system and plug-in modules (or extensions). A good example is a web browser, which is equivalent to a core system that lets you install extensions (or plugins) indefinitely.

Decipher 5 software architecture patterns

Figure 3: Microkernel architecture

4. Microservices architecture

A microservices architecture consists of individually deployed services, each of which should preferably have a single responsibility. These services are independent of each other, and when one of the services fails, the others are not interrupted.

Decipher 5 software architecture patterns

Figure 4: Microservices architecture

5. Space-based architecture

The main idea behind the space-based model is distributed shared memory to alleviate problems that often occur at the database level. Its assumption is that by using in-memory data to handle most of the operations, we can avoid additional operations in the database and thus avoid any problems that may arise in the future (for example, if your user activity data entity changes, you don't need to change a bunch of code to persist and retrieve that data from the database).

The basic approach is to separate the application into processing units (which can automatically scale up and down as needed), and data will be replicated and processed between those units without having to persist to a central database (although there will also be local storage in the event of a system failure).

Decipher 5 software architecture patterns

Figure 5: Space-based architecture

You can find some of the simplest examples of architectural patterns in my GitHub account. Here are the links:

Hierarchical mode (using Java)

https://github.com/OrkhanHuseynli/recording-job

Microkernel or plug-in mode (using Go or Golang)

https://github.com/OrkhanHuseynli/plugins_design_in_go

Microservices pattern (using Go)

https://github.com/OrkhanHuseynli/microservices_template_golang

About the Author:

Orkhan Huseynli, software engineer.

https://orkhanscience.medium.com/software-architecture-patterns-5-mins-read-e9e3c8eb47d2

Read on