Tech Talk

Tech Stack: Explaining Software Architectures

Tech Stack: Explaining Software Architectures

When it comes to creating small, medium, and large-scale applications, developers must decide on which software architecture they want to use. Finding a suitable architecture which allows them to achieve the quality and functionality needed is a key stage in the process, but there are a lot of different types to choose from.

There are so many to choose from that covering them all would be time-consuming. Instead, we’ve broken down the top three software architectures that we think are most effective when it comes to developing an application. Read on to find out more. 

Layered

Layered architecture is one of the best known patterns that a great deal of software developers currently use. This pattern spits code into separate ‘layers’, each of which has its own individual responsibility and provides a unique service to another higher layer. 

Here’s an example of how a layered pattern would look:

  • Presentation (or U.I.) layer
  • Application layer
  • Business (or domain) layer
  • Persistence (or data access) layer
  • Database layer

Layered patterns work by initiating a piece of code in the presentation layer when an action is performed, such as pressing a button. The Presentation layer will then transfer the message to the Application layer, which filters down to the Business layer, and then the Persistence layer transfers this data to the database layer where it is stored. 

Of course, this process might vary depending on the software, and some applications will omit the application layer altogether as it may not be necessary. Some layers might even be merged into one. Using layered patterns is an easy way for developers to test and organize their apps and code, which is why it is so widely used. 

Hexagonal

Hexagonal layers are also known as ‘clear’ layers, and the core idea behind this pattern is to put the inputs and outputs of code at the edges of your design. It allows developers to isolate the core of their application so they can swap out handlers and make changes to code without disrupting the core code of their application, overall, making code much easier to test.

There are three principles to using hexagonal layers as a software architecture:

  1. It separates elements from Application, Domain, and Infrastructure
  2. Dependencies are moved from Application and Infrastructure to Domain
  3. Boundaries are isolated using Ports and Adapters.

To get a clearer idea of how Hexagonal layers work, imagine a hexagon within another larger hexagon. The centre hexagon forms the core of the application, where the key code is contained. The layer between the core and the outer hexagon forms the adapter layer, and each side of the outer hexagon represents the ports. 

Essentially, Hexagonal layers are all about swapping out components, and it’s a way to make the core of the application independent of its inputs and outputs. This pattern allows the developer to separate problems and focus on a single logic (i.e. application, business, or infrastructure) without impacting the others. 

Vertical

Vertical patterns, also known as vertical slices, is a software architecture that aims to de-couple features inside of a service. Working with a vertical pattern means that a feature will be completely isolated from one to another. It requires breaking up project work into vertical slices, and is often associated with Scrum & Agile processes. It essentially enables a project to be split into smaller, more manageable pieces. 

Vertical slices are often very easy to apply and using them means that changes made to one feature will not impact another feature as a result. Plus, once work is completed using a vertical pattern, it is ready for testing and implementation right away. However, vertical architectures should be small, and they typically only work on a few features, rather than a large-scale project. 

Vertical architectures are a great starting point for any architecture as they enable fast MVP building and simplify the testing and launch process significantly. 

Which software architecture will you use? 

These are just a few of the most popular and effective software architectures widely used by developers when building an application. They all have their own benefits and disadvantages, but when used correctly, they can have a significant impact on streamlining the process to testing and implementation.


 

Which software architecture do you use, or which do you think is best? Let us know over on Twitter:


Recent posts

Software

ATDD & HonestCode: A Perfect Pairing


Published April 20, 2020


Tech Stack Series

Tech Stack: Explaining Software Architectures


Published March 20, 2020