Human Brain: a perfect analogy for solving complex problems in Software Architecture


As Software architects, we are constantly looking around us for solutions to complicated problems that arise in daily life. The human brain is one of these things with many possibilities for architects to take ideas from. The functioning of the human brain provides many opportunities for architects to create cognitive designs, define analogies and take guidance to solve complex problems in software architecture. In this article, I am trying to list some such instances which I find relatable and interesting.

The human brain is the central organ of the human nervous system that is made up of a complex system of neurons. Neurons are the fundamental unit of the Human brain. Neurons are cells that transform and relay electrical and chemical interactions in the human body. The figure of two neurons in synaptic connection is shown in the figure below. You may visualize this as two connected nodes in a web of interconnected nodes creating the human brain, a complex system of 100 trillion neurons.  Neurons are responsible for the human brain to make decisions and control our actions.

Figure 1 Two neurons in synaptic connection

Image Credits
https://www.researchgate.net/profile/Manu-Jayadharan/publication/316553702/figure/fig1/AS:488168630820865@1493399879390/1-Two-neurons-having-a-synaptic-connection-sourceinternet.png

The human brain is anatomically divided into two hemispheres. Each hemisphere has four sections called lobes. Each lobe has specific functions. For instance, the Frontal lobe is responsible for higher cognitive functions including memory, problem-solving, and social interactions. Metaphorically in software architecture, multi-layered architecture is a complex system that is sliced into multiple layers and components. Each layer and component are responsible for specific functions.

Memory Management 

“Other morning, I was discussing something with a friend and he happened to mention a company name. Somewhere, in the back of my mind, I have heard the company name but was not able to place it immediately. Though I forgot all about this conversation, in the evening it came back to me that it is where one of my relatives works.”

Many of us have similar experiences where we know something but could not place it at the time. It comes back to us later. Why? 

The human brain handles different types of memory – short-term and long-term. Short-term aka working memory contains information that a person is currently thinking about or aware of. Short-term memory is stored in the frontal lobe of the human brain. Then the information for long-haul makes a stopover in the hippocampus before moving to the cerebral cortex.

This has a corollary to a few patterns, solutions, and frameworks we see around in software architecture. For instance, in .net CLR, the garbage collector performs the allocation and release of memory of an application. The runtime reserves a contiguous heap of address space called the managed heap for a new process. The managed heap is divided into three generations, 0,1 and 2. Gen 0 contains new and short-lived objects. As garbage collection runs, it reclaims unreachable objects from Gen 0 and promotes reachable objects to Gen 1. Gen 1 is a buffer between short-lived and long-lived objects. Finally, the garbage collection process moves the long-lived objects like static data that live for the duration of the process to Gen 2.

In Azure, the data is stored in the Hot, Cool, and Archive Tier. The hot tier contains data that is accessed frequently. With the high cost of storage in this tier, architects focus on keeping minimal and most accessible data in the tier. Cool tier stores long-term infrequently accessible data which could be retrieved at a faster rate. Archive tier stores long-term data with long retrieval timelines.

AWS has an exhaustive list of storage classes to choose from. S3 Standard contains frequently accessed data. S3 Standard-IA, Glacier Instant Retrieval, Glacier Flexible Retrieval contains data that is infrequently/rarely accessed but has fast retrieval timelines. S3 Glacier Deep Archive contains data for the long haul and has extremely slow retrieval rate.

Memory Retrieval

Long-term memory holds the information in many forms – 

a) Rehearsed: Information from short-term memory moves into long-term memory through rehearsal. They have a faster retrieval rate. 

b) Explicit memory (Conscious): are long-lasting experiences, behaviours, facts that are consciously stored. They may have a slow or fast retrieval rate.

c ) Implicit (Unconscious/Semiconscious): are long-lasting experiences, behaviours, facts like the scenario above. They have a slow retrieval rate. The company name in the above scenario is an example of this form, where the brain has stored the name in long-term memory and retrieval was slow.

The multi-store model of memory (Atkinson & Shiffrin, 1968) explained the process of transfer of data between different types of memory stores of the human brain. 

Figure 3 Atkinson and Shiffrin memory model.

Image Credits: Atkinson, R. C. and Shiffrin, R. M. The Psychology of Learning and Motivation, 2, 89-195, 1968.

Similarly, the S3 Lifecycle configuration is a set of rules that define actions that Amazon S3 applies to move data between the storages for access. Further, Intelligent Tiering in AWS is designed to intelligently move data between the storages for access. S3 Intelligent Tiering stores objects in two tiers – one that is optimized for frequent access and another that is optimized for infrequent access.

Figure 4 AWS S3 Lifecycle policies diagram
 
Image Credits:
https://csharpcorner-mindcrackerinc.netdna-ssl.com/article/how-to-enable-lifecycle-management-in-s3-bucket-using-aws-portal4/Images/SupportedTransitionsWaterfallModel.png

Caching is another example where the data is retrieved from long-term storage into temporary storage for faster access. In software, there are different types of caching – data caching, page fragment, and page-level caching implemented. 

Memory Encoding

Researchers have found that the data capture and movement from short-term memory to long-term memory is not symmetrical. There are concepts of chunking, encoding, sorting, pattern recognition involved.

Large amounts of data captured by the sensory mechanism and behavioural experiences go through the process of chunking in the brain. The term Chunking was introduced by Miller in his paper “The magical number seven plus or minus two: Some limits on our capacity for processing information”. Chunking is described as the process of breaking down information into individual pieces.

Figure 5 Chunking (psychology) Wikipedia diagram

Image Credits: https://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/HierarchicalChunking.jpg/600px-HierarchicalChunking.jpg

Miller asserted that the human brain can, on average, manage to keep seven items of information in short-term memory. In software development, Chunking has applications in UX design, Code Structure and rewrite of critical systems, DFDs, NLP and more. For instance, Design Thinking includes the right application of chunking in UX Design; the grouping of numbers in the phone number and credit card, visual hierarchies, the grouping of content as per the Law of Proximity and Similarity. In modular programming, the code is built out in small chunks – functions, modules. Chunking is also a good strategy for breaking the monolith. Approaches like Microservices architecture and Strangler pattern are focussed on splitting software for better organization and incrementally replacing existing functionality with new solutions respectively. 

Figure 6 DFD Using Yourdon and DeMarco Notation

Image Credits:
https://online.visual-paradigm.com/servlet/editor-content/knowledge/software-design/dfd-using-yourdon-and-demarco/sites/7/2020/03/dfd-different-levels.png

Data Flow Diagram (DFD) represents the flow of data in a process or a system. DFD notation by Yourdon and DeMarco provides that more than seven bubbles at any level of decomposition of DFD is a sign of bad design.

Encoding, as per Wikipedia, allows a perceived item of use or interest to be converted into a construct that can be stored within the brain and recalled later from long-term memory. Further, memory encoding includes visual, acoustic and semantic. Encoding is inherent in the software world be it Base64 encoding of Images, Linear Pulse-code modulation (Linear PCM) of analogue signals or compilation of a programming language to machine code. Encoding aims to convert image, sound and semantic information into a data format that can be stored. Similarly, the hippocampus in the human brain also acts as a sorting centre comparing and organizing memories in conscious and unconscious storage.

Pattern recognition is a deep core capability of the human brain. As per Tiago Forte in “A Pattern Recognition Theory of Mind”, the basic structure and functioning of the human brain is hierarchical. The hierarchies are made up of patterns. Our brain works through massively parallel pattern recognition. 

In the above figure, even if you don’t read the right-hand side information, you will most likely do just fine reading left-hand side scrambled information. Our brain is focused on patterns that it has seen, heard, experienced before. At the same time, it keeps learning new patterns. The neocortex, the outermost layer of the brain, is responsible for our ability to recognize patterns.

Figure 8 Pattern Recognition in Machine Learning

Image Credits:
https://serokell.io/blog/pattern-recognition-in-simple-words

Pattern recognition in software uses machine learning algorithms to recognize patterns and is achieved through learning. Data is divided into training and test sets. The training set focuses on building a system. The trained system is then used to predict the outcomes of the test set. Pattern recognition is applied in computer vision, speech recognition, biometrics, Healthcare, Banking and more.

Emotional Hijacking

Daniel Goleman in his bestselling book “Emotional Intelligence” described Ledoux’s work for understanding emotional life. His research shows that sensory signals from the eye or ear travels first to the thalamus, and then across a single synapse to the amygdala; a second signal from the thalamus is routed to the neocortex. This branching allows the amygdala to begin to respond before the neocortex, which mulls information through several levels of brain circuits before it fully perceives and finally initiates a tailored based response. The amygdala learns from the experience to provide a more tailored based response in similar situations in future.

Figure 9 Amygdala Hijack

Image Credits: https://en.wikipedia.org/wiki/Amygdala_hijack#/media/File:EQbrain_optical_stim_en.jpg

This functioning of the human brain may have many applications in software architecture. Think of the systems that require faster responses in critical situations. For instance, a missile system where the mission needs to be aborted. In a chemical factory wherein a critical unpredictable situation, the system needs to be aborted. A self-driving car needs to apply sudden brakes in an unforeseen scenario to avoid a crash. Switch-based network architecture is one such example where this working on the human brain can be applied, making a group of switches act as the amygdala to provide the behavioural response of the system. This group shall have loose connections from an intrinsic set of switches which in turn are responsible for relaying the signals to the processing unit to formulate a more tailored based response.

Conclusion

The human brain being a complex system itself solving problems of storage, retrieval, encoding, responses and others provides a wealth of information to solve similar problems in software architecture. By analogy or corollary, software architects shall refer to the human brain to find answers to complex problems of the real world. 

References:

  1. Neural Network Processing: Modelling and Simulation of Neurons and Neural networks

https://www.researchgate.net/publication/316553702_Neural_Network_Processing_Modelling_and_Simulation_of_Neurons_and_Neural_networks

  1. The magical number seven plus or minus two: some limits on our capacity for processing information

http://www2.psych.utoronto.ca/users/peterson/psy430s2001/Miller%20GA%20Magical%20Seven%20Psych%20Review%201955.pdf

  1. Break the monolith: Chunking strategy and the Strangler pattern https://www.ibm.com/garage/method/practices/code/chunking-strategy-strangler-pattern/
  2. StranglerFigApplication

https://martinfowler.com/bliki/StranglerFigApplication.html

  1. Encoding (memory)

https://en.wikipedia.org/wiki/Encoding_(memory)

  1. Daniel Goleman, Emotional Intelligence (2013), p. 17-18
  2. DFD Using Yourdon and DeMarco Notation

https://online.visual-paradigm.com/knowledge/software-design/dfd-using-yourdon-and-demarco

  1. On Routing Schemes for Switch-Based In-Vehicle Networks

https://www.researchgate.net/publication/224243218_On_Routing_Schemes_for_Switch-Based_In-Vehicle_Networks

  1. A Pattern Recognition Theory of Mind

https://fortelabs.co/blog/a-pattern-recognition-theory-of-mind/


Leave a comment