Introduction to Architecture30318 2019-05-11 15:52
Architecture is the shape of the software system. Thinking it as a big picture of physical buildings.
- paradigms are bricks.
- design principles are rooms.
- components are buildings.
Together they serve a specific purpose like a hospital is for curing patients and a school is for educating students.
Every software system provides two different values to the stakeholders: behavior and structure. Software developers are responsible for ensuring that both those values remain high.
Software architects are, by virtue of their job description, more focused on the structure of the system than on its features and functions.
Architecture serves the full lifecycle of the software system to make it easy to understand, develop, test, deploy, and operate. The goal is to minimize the human resources costs per business use-case.
The O’Reilly book Software Architecture Patterns by Mark Richards is a simple but effective introduction to these five fundamental architectures.
The layered architecture is the most common in adoption, well-known among developers, and hence the de facto standard for applications. If you do not know what architecture to use, use it.
- TCP / IP Model: Application layer > transport layer > internet layer > network access layer
- Facebook TAO: web layer > cache layer (follower + leader) > database layer
Pros and Cons
- ease of use
- separation of responsibility
- hard to adjust, extend or update. You have to make changes to all the layers.
A state change will emit an event to the system. All the components communicate with each other through events.
A simple project can combine the mediator, event queue, and channel. Then we get a simplified architecture:
- QT: Signals and Slots
- Payment Infrastructure: Bank gateways usually have very high latencies, so they adopt async technologies in their architecture design.
The software’s responsibilities are divided into one “core” and multiple “plugins”. The core contains the bare minimum functionality. Plugins are independent of each other and implement shared interfaces to achieve different goals.
- Visual Studio Code, Eclipse
- MINIX operating system
A massive system is decoupled to multiple micro-services, each of which is a separately deployed unit, and they communicate with each other via RPCs.
- Uber: See designing Uber
This pattern gets its name from “tuple space”, which means “distributed shared memory". There is no database or synchronous database access, and thus no database bottleneck. All the processing units share the replicated application data in memory. These processing units can be started up and shut down elastically.
Examples: See Wikipedia
- Mostly adopted among Java users: e.g., JavaSpaces