Architectural Design Patterns 1 – Layered (or Tiered) Pattern

Architectural Design Patterns 1 – Layered (or Tiered) Pattern

Here in this first post of the blog, I want to also start with the first part of a series. In this post of the series, we will be talking about Layered (or Tiered) Pattern. When you’re building a software project, you need a plan to organize your code. That’s where architectural design patterns come in. Architectural design patterns is a huge topic getting more and more interest by software developers and businesses. I want to write about the most popular architectural design patterns as a series of blog posts.

What is the Layered Pattern? Imagine a cake with several layers. Each layer has its own flavour and role in making the whole cake delicious. In the same way, the Layered Pattern splits a software application into different layers. Each layer has its own job, making sure the whole app runs smoothly.

The layers we talk about are as follows:

Presentation Layer
This is the layer the users see and interact with. It’s your app’s user interface (UI). For instance, this could be the web pages with buttons, text boxes, and images in a web site. In a mobile app, it’s the screens where users tap and swipe.

Business Logic Layer (or Service Layer)
This layer processes data and makes decisions. It’s like the brain of the application. Let’s say you have an online store. When a user places an order, this layer checks if items are in stock, calculates the total price, and decides if the order can be completed.

Data Access Layer
This is where your app talks to databases or other places where data is stored. For example, when a user signs up for your app, their username and password might be saved in a database. This layer is responsible for saving and retrieving that info.

Infrastructure Layer
This layer helps the other layers do their jobs by offering common services like logging, error handling, or communication tools. For example, if your app needs to send emails (maybe order confirmations for an online store), this layer could have the tools to do that.

The cool thing about the Layered Pattern is that each layer only talks to the one below it. So, the Presentation Layer talks to the Business Logic Layer, but it doesn’t directly talk to the Data Access Layer. This keeps things neat and organized.

When a user interacts with your app, their request moves down through the layers. Using our online store example: A user clicks ‘Buy Now’ (Presentation Layer) -> The order gets processed (Business Logic Layer) -> The order details are saved in the database (Data Access Layer).

Suleyman Cabir Ataman, PhD

Sharing on social media:

Leave a Reply