System Architecture: The Beginning

System Architecture: The Beginning

Learning System Design

This blog post is the first part of the system architecture series. Before we start, let me clarify that I am not a system design/architect. I am also learning along while writing this series.

Introduction

Building out the base is the most crucial step in the software development process. Think like you are building a house. You need the base strong to support the whole house. Software projects are similar to building the house. You need a solid base so there are few hiccups down the road. Before we dive deep let’s get an overview of the software development process

An Overview of the Software Development Process

The first step of the software development process is Requirement Gathering & Analysis. This is the step where developers and software managers gather business requirements. The next step in the process is to write down the features needed to be build and also figuring out the corner cases which might be problematic to build. The third step is now to write down a high-level design document. And after all the information gathering and figuring out the features needed to be built, It’s time for everyone’s favorite part of the process where you pick the tech stack to build out those features. The most basic thing in the system architecture is the concept of tiers.

What is a Tier?

You can think of a tier as a layer. There are different numbers of tiers or layers depending on the requirement of your software.

Single Tier Applications

A single-tier application is an application where the front-end, back-end, and database all reside in one place. Typical examples are PC Games, any editing software like PhotoShop, etc. You can argue that PhotoShop and other tools nowadays have become cloud-based but here we are talking about older versions. The local application you are trying to build on the localhost might also be considered a single-tier application. So now you know what is a single-tier application let’s now discuss its pros and cons.

Advantage of Single Tier Applications

The main upside of such applications is they are fast and there is no lag in the communication between the three components of the application. The data also remains in the user’s machine which ensures the highest level of security (If your laptop/PC is not hacked 😀)

Disadvantages of Single Tier Applications

The biggest con of single-tier applications is that the company/business has no control over the application. They cannot provide the user with additional features in the future until the user connects to their server manually. The code of such applications is vulnerable to the risk of reverse engineering which can be a risk to the company’s authenticity.

Two-Tier Applications

A two-tier application has two layers, a client and a server. The client would have a user interface and business logic in one machine. And the server would usually contain a database.

Advantage and Disadvantage of Two-Tier Applications

There is a risk of getting the business logic stolen in such so not all applications use this approach. A To-do list or some sort of productivity app is an example of an app that might use such architecture. Because it wouldn’t matter if the code is stolen. But the upside of such an application is fewer network calls which reduce latency. The server will be called only when the user finished some tasks and want to persist in that change. It purely depends on the company’s requirement to pick such an application. If you move business logic to a dedicated server it makes it a three-tier application which we are going to see next.

Three-Tier Applications

As mentioned above in three-tier applications user interface, business logic and database are all on different layers. And the only user interface is exposed to users. Examples of such architecture are all the simple websites from blogs to news websites.

In such applications business has control over the logic but separating the interface, logic, and database increases the latency.

No, let’s discuss our final tier application

N Tier Applications

N-tier applications have more than three components.

Examples of such applications are all the social media applications, all the large-scale applications like Uber, Airbnb, etc. N Tier Applications are also called distributed applications. Now you might be thinking what components are there other than interface, logic, and database? Here is the list of those components

  • Cache
  • Message Queues
  • Load Balancers
  • Search Servers for searching the massive database
  • Servers to process massive amounts of data

We will cover everything in upcoming posts. So Stay tuned. You might be wondering why so many layers? N tier applications follow two software design principles that are Single Responsibility Principle and the Separation of Concern.

Single Responsibility Principle

The Single Responsibility Principle simply means giving one responsibility to the component and let it execute that task with perfection. The responsibility could be processing data, caching the data, etc. This approach gives us a lot of flexibility and makes managing the service easier. Let say a database server does down it won’t affect the whole application, only the parts which require database will be affected. We can separate the teams and code bases for each component making things cleaner.

Separation of Concern

Separation of concerns kind of means the same thing. Be concern about your work and stop worrying about others. Keeping the components separate makes them reusable. This approach makes scaling the application easier in the future. Final Note I have mentioned thinking tiers as a layer but don’t confuse with the term layers of the application. Application layer typically means interface layer, business layer, service layer, or the data layer. Whereas tier is a physical separation. Application Layers represent the organization of the code.

Conclusion

System designing is one of the most important parts of the software development process. There are different tiers of application:

  • Single Tier
  • Two Tier
  • Three Tier
  • N Tier

N Tier Applications follow two main software design principles

  • Single Responsibility Principle
  • Separation of Concerns.

Did you find this article valuable?

Support Rushil Patel by becoming a sponsor. Any amount is appreciated!