Introduction to N-Tier Architecture
As a follow up to the previous posts/tutorials about software architectures, this post is an introduction to what multitier architectures are, when to opt for them and the different ways in which they are implemented. It’s also an introductory post to what comes next about JEE and ASP.NET technologies.
1- What is N-Tier architecture ?
Software built on N-tier or multitier architecture is engineered to have the processing, data management, and presentation functions physically and logically separated. These different functions are hosted on several machines or clusters, ensuring that services are provided without resources being shared and, as such, these services are delivered at top capacity. That’s why such applications are also called “distributed applications”, and it’s also the reason that great products are often built on multi-tier architecture.
A typical n-tier application includes a presentation tier, a logic tier, and a data tier. The easiest way to separate the various tiers in an n-tier application is to create discrete projects for each tier that you want to include in your application. What would differentiate this from the MVC design pattern is that tiers are physically seperate. Which implies you can use the MVC framework (within the presentation tier for example) while working on a whole n-tier architecture application.
Obviously, it exists n-tier architecture models that have more than three tiers. A multi-tier application could hold a business domain tier, a services tier or a client tier. In the following various tutorials on ASP.NET and JEE technologies, we’ll be detailing each and passing by concrete examples of each.
2- When and why to opt for an N-Tier achitecture ?
Distributed or multitier applications are usually built around the database. The code is arranged so the data enters the top layer and works its way down each layer until it reaches the bottom, which is usually a database. Along the way, each layer has a specific task, like checking the data for consistency. And many applications in business naturally lend themselves to storing information in tables, which accords to using an n-tier architecture.
Multi-tier architecture also adapts to :
• new applications that need to be built quickly.
• enterprise or business applications that need to mirror traditional IT departments and processes.
• teams with inexperienced developers who don’t understand other architectures yet.
• applications requiring strict maintainability and testability standards.
When it comes to why would teams choose a framework built on a multi-tier architecture, the main advantage of this architecture, and the main reason for opting for it, is the separation of concerns, which means that each layer can focuses solely on its role: the presentation layer client doesn’t know how the server is working internally, and the server doesn’t know how the database server works internally etc, they just communicate via standard interfaces. This makes it maintainable, testable and easy to assign separate “roles” and easy to update and enhance layers separately.
3- Web and mobile applications
Web applications are a very common example of 3 tier applications. The presentation tier consists of HTML, CSS and JavaScript, the application logic tier runs on a web server in form of Java Servlets, JSP, ASP.NET, PHP, Ruby, Python etc., and the data tier consists of a database of some kind (mysql, postgresql, a noSQL database etc..), as shown in this diagram :
And it is the same principle with mobile applications that are not standalone applications. A mobile application that connects to a server typically connects to a web server and sends and receives data.
We’ve explained N-tier architecture in the simplest and quickest way possible in this article. It exists however very much rich articles and posts about this architecture. My favourite is this CodeProject article: N-Tier architecture and tips, I recommand you check it if still looking for more details.
As a follow up, we’ll be working on details and seeing implementation examples in the coming JEE and ASP.NET tutorials.
Recent Comments