Software Architecture as I know [always a WIP ;)]
Tags: architecture, whatis, development, design
Published: 2022-10-27 15:52:19

Software architecture serves as a blueprint for a system. It is the organization of a system which includes all components - their interaction, operation with each other, environment, design principles used and the decisions made.

**Why is it important?**
Software architecture is the foundation of a software system which has a profound effect on the quality of what is built on top of it. A proper foundation yields number of benefits whereas sub-optimal decisions may later cause development, security, performance, scalability & maintenance concerns.

**Different types of architecture patterns**
Some common examples of architecture styles include Monolithic application, Layer based, Client-server pattern, Event-driven, Microservices etc.

Each pattern pertains to specific characteristics and behavior - some contribute to scalability whereas others are more agile. Knowing these strengths & weaknesses of each architecture pattern is necessary to choose the one that meets your use case. 

**<u>Layered Architecture</u>**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0g5bvnd0f58u5vundvzg.jpg)
Layered architecture (also known as the N-tier architecture) is the de-facto standard for designing majority of software. Here the codebase is separated into layers - each with a specific role & independent of the other.

_Challenges/Limitations:_

- Defending boundaries.
- Tight coupling leading to complex interdependencies.
- Without proper coordination between team members, source code can turn into a mess.

**<u>Microkernel Architecture</u>**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0mn8tivn1gzmc0vrnhq.png)
Microkernel pattern has two major components - a core system and plug-in modules. The core handles fundamental and minimal operations whereas the plug-in modules handle the extended functionalities. IDEs are the best example for this pattern. 

_Challenges/Limitations:_
- not highly scalable.
- changes to core system will result in changes to plug-ins.

**<u>Event-driven Architecture</u>**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sn7q5hf4y0lm7e3i3x8l.jpeg)
EDA enables an application to detect “events” like mouse hovers, button clicks and act on them. This asynchronous communication replaces the request/response architecture where services would have to wait for a reply before moving onto the next. 

_Challenges/Limitations:_
- Complexity of implementation
- Anticipation of the unknown
- Error-Handling

**<u>Microservices Architecture</u>**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjkl75idu9djx94yy041.png)
In microservices architecture the application is developed as a collection of services which are loosely-coupled, fine-grained & communicate via lightweight protocols. This makes additions of features and modification of existing ones independent of others.
 
_Challenges/Limitations:_
- Increased development time
- Limited reuse of code


## Pattern Analysis
A good software architecture should facilitate scalability, agility, addition of new features, integration with external APIs & easily maintainable.

Attached below is a table enlisting key attributes of each of the architecture pattern discussed that can help you determine which pattern to select based on your use case.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hncyal9s6sst9gjgpu66.png)