Readable Architecture

Table of contents

Purpose
Often, we come across literature, articles etc. where we see a complex topic like software architecture being discussed and explained in an even more complex fashion. As human beings if something becomes too complex or ambiguous to use, we often refrain from using it.
However we should not shy away from comprehending the purpose of software architecture, rather we should be able to relate architecture to implementation and be able to reason about its various trade-offs. Our minds would grasp a concept better if the learning tool uses analogy, because analogy is one of the major tools that we have been taught to use as a child for learning. It might also helps us vizualize abstract concepts. For example, electromagnetic waves exist in nature but not as the graphs we see them in a book. We use graphs to visualize them better.
Let’s explore some of the 3 commonly used layers of architecture in a simple fashion with analogies.
System Design
Represents how two logical/computational or physical/real-world entities, like software processes, networks, or human beings, are meant to interact.
Aims to establish how the interaction is curated rather than focusing on what is done to achieve it.
Without a proper communication structure, there is no clear direction or constraints on communication, making pattern recognition and optimization difficult.
Defines the "API" or protocol for how two entities communicate.
Allows for writing E2E tests to perform black-box testing of the interactions.
Analogy: Social Interaction Between Two Humans
Description: This level defines the "API" or protocol for how two people communicate.
Interaction: They will communicate using spoken English.
Interface: Person A asks a question, Person B listens, processes, and provides an answer.
Constraints: They won't interrupt each other; they will stand at a comfortable distance.
Testing (E2E): We observe a full conversation between them to see if they can successfully exchange information and achieve a goal (e.g., ask for and receive directions). We don't care how their brain forms the words, just that the correct words come out in the right sequence.
High Level Design
- This represents the internal parts of the individual components responsible for enabling different parts of the interaction/communication.
- At this stage, we look into things like sub-modules of the larger system.
Analogy: The Organ Systems of a Single Human
Description: This level breaks down one human into its major functional components and shows how they interact.
Components:
The Nervous System
Circulatory System
Respiratory System
Muscular System
Interaction:
To wave a hand, the Nervous System (brain) sends a signal.
The Circulatory System provides energy (oxygen and glucose) to the muscles.
The Muscular System contracts to move the arm.
The Respiratory System supports the circulatory system.
Testing (Integration Testing):
We test if sending a signal from the brain correctly results in the arm moving.
We are testing the interaction between the organ systems.
Low Level Design
This represents the details that make up each part of the system.
At this stage, every piece of code is deterministic.
Various design patterns and algorithms come into play.
We are able to write unit test cases to validate that individual function definitions work as expected.
Analogy: The Cellular Structure and Function of a Single Organ (e.g., the Heart)
Description: This level describes the exact implementation of one component from the HLD.
Details:
How are the heart's chambers (atria, ventricles) structured?
What is the specific arrangement of cardiac muscle cells?
What is the electrical conduction pathway (SA node, AV node)?
Algorithms/Patterns:
The precise biochemical process of a muscle cell contracting (the sliding filament model) is an "algorithm."
The structure of a sarcomere is a biological "design pattern."
Determinism:
- A specific electrical stimulus (x) applied to a specific nerve will deterministically cause a specific muscle cell (y) to contract.
Testing (Unit Testing):
We isolate a single cardiac muscle cell and apply a stimulus to see if it contracts as expected.
We are validating one "function" in isolation.
In conclusion, if we identify, isolate and understand the different elements at each level, we can start reasoning on their existence and be able to contribute towards improving them rather than restricting ourselves to just implementing them.
Subscribe to my newsletter
Read articles from Diganta Mukherjee directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Diganta Mukherjee
Diganta Mukherjee
I am a software developer by profession. I have been growing in the world of Software development for quite some time now and have navigated my way through various technologies, stacks, development methodologies, frameworks, patterns and each of them were unique experiences. Its exciting to be part of this evolution that is not only catering to solving day-to-day problems but is creating scope for the scientific world to develop by solving its "logico-mathemetical" problems. Cheers!