3LA Introduction

Ryan Smith
2 min readJun 14, 2017

--

This blog post aims to further document and raise awareness of the three layer architecture (3LA) for software applications, since I believe that software engineers lack documentation and awareness of it. This is not to be confused with the three tier architecture that refers to hardware. This blog post will attempt to summarise the 3LA as I understand it.

In the diagram above, there are two things external to the Application; the User and the Computer. The User is typically a person or external application. The Computer is typically a database, file, or external application. Data flows down as input from the User, through the Application, to the Computer. Data also flows up as output from the Computer, through the Application, to the User. In this sense, we’d define a User as an external entity that provides input and receives output, whilst we’d define a Computer as an external entity that receives input and provides output.

As the name of the architecture and the diagram above suggest, the Application has three layers: the presentation layer (the Presenter) for User-to-Domain code, the domain layer (the Service) for User and Computer agnostic code, and the data layer (the Repository) for Domain-to-Computer code. The Presenter typically contains code for handling HTTP requests, browser events, component rendering, CLI commands, etc. The Service typically contains code for handling validation, authorization, transformations, etc. Finally, the Repository typically contains code for reading/writing to a database/file, making HTTP requests, etc.

Finally, there is one rule in the 3LA that the code in one layer should only call code in the same layer or the layer below. The purpose of this rule and placing code into layers is to separate concerns and increase code reusability.

To conclude this first blog post, the key parts of the 3LA are the User, Computer, Presenter, Service, Repository, Input Data, Output Data, and the Application.

Massive thanks to my colleagues James and Pete at HT2 Labs! They generously gave their time to read and review this post.

--

--

Ryan Smith

Aiming to simplify meaningful challenges, so that together, we survive and evolve. Unlocking the extraordinary as a Software Dev. Manager at LP.