5 minutes read

This topic will introduce to you a popular client-server architecture style. It divides the application into three separate tiers. You'll learn about what role each tier has, the relationship between them, and popular technologies you can use to implement them. In the end, you'll learn about the advantages and disadvantages of this approach.

What is a three-tier architecture?

A three-tier architecture is a client-server software architecture approach performing as a relation between three logical components where each has its role. Don't confuse this with a three-layer architecture. In a three-tier architecture, each tier is a layer but runs on different physical hardware and as a rule, tiers communicate with each other through the web. In the case of the three-layer architecture, all layers run on the same hardware.

three-tier architecture

Three layers or tiers are:

  • Presentation tier: the graphical user interface(GUI) of the application.

  • Application tier: the business logic layer of the application.

  • Data tier: the database tier that gives access to the application's data.

In this topic, our focus is on web development, but this approach can also be applied to desktop or mobile applications.

Such a software design approach separates the system into different parts and helps to get benefits from such a division. Let's learn more about each tier.

Presentation tier

The role of this tier is to display the application data for the user and present a user-friendly graphical interface to interact with the functionality of the application. Simply put, it's the application's front end, what users see on their devices.
In modern web development, the presentation tier is built on HTML, CSS, and JavaScript and a bunch of tools, libraries, and frameworks for them. At first glance, implementing a user interface might seem to be easy, but it has a lot of challenges. As you know, there are plenty of devices with different screen resolutions. One of the biggest challenges of this tier is to make it work for all kinds of screens. Developers working on the user interface use two techniques for this purpose:

  • Adaptive design to develop a different design for different resolutions using media queries.

  • Responsive design to make it fluid by setting relative size for interface elements.

Additionally, there are two CSS layouts: Flexbox and Grid. These are widespread techniques that make front-end development much faster and easier.

Application tier

The application tier defines the application logic holding the back-end code of the application and is responsible for the communication with servers. This layer is the intermediate communication channel between the presentation and data tiers, since they can't communicate directly. It responds to requests from the user interface, managing all the operations and data processing of the application. In this tier, developers deal with back-end programming languages such as Java, Kotlin, C++, Python, Go, PHP, and even functional languages like Erlang/Elixir, Closure, and Haskell.

Data tier

The data tier provides the direct communication channel to operate with the database. This tier is responsible for storing and managing all application data. Depending on needs, it can use either SQL databases such as Microsoft SQL Server, MySQL, and PostgreSQL or NoSQL databases such as MongoDB, Redis, and graph databases like Neo4j. Nowadays, databases can also be provided by cloud services. Such examples are Microsoft Azure SQL, GCP Cloud SQL, and AWS DynamoDB. Note, that the application can have one or more databases for different purposes. For instance, it can have any SQL database to store user data and Redis to store the application cache.

Advantages and disadvantages

When choosing this or that architectural approach, you should know what its strengths and weaknesses are. The three-tier technique has some advantages, which include:

  • Faster development: This approach allows updating each tier independently of the other level. Development teams working on different tiers can work in parallel with each other.

  • Increased maintainability: Dividing the code into layers makes it easier to update or modify each of them.

  • Flexibility: When each tier is separated and independent, you can easily change one of them without affecting others. Imagine one day you decide to change the UI of your application. You can do it without changing anything on the application tier.

  • Improved performance: Heavy loads on one tier don't affect the performance of others.

Along with benefits, this approach can also have disadvantages, such as:

  • Security issues: When each tier is physically separated and the communication is through the web, it can bring security issues if the connection channel isn't secure enough.

  • Troubleshooting complexity: Dealing with several tiers adds an extra level of complexity. For instance, if you want to investigate an issue with a feature that involves all levels, debugging such cases can be confusing.

  • Higher cost: Running each tier on different physical hardware or service increases the cost of the application and its support. You must spend more resources to buy, configure, and maintain them.

As you can see, this approach gives some benefits, but on the other hand, it can bring up issues. As with many technology solutions, you need to take into consideration all the pros and cons before choosing this architecture.

Conclusion

In this topic, you've learned about a common architectural approach for client-server applications. You explored its three components one-by-one, what technologies you can use for each of them, and what its advantages and disadvantages are. This isn't the only architecture based on tiers. There is also a two-tier approach, even more, you can implement a system with more than three tiers(n-tier) for your application. Software architecture is a complex but interesting topic where you have a lot to learn.

62 learners liked this piece of theory. 3 didn't like it. What about you?
Report a typo