Three-Tier Architecture

Professor Ortiz presents a little of the theory behind the three-tier architecture and shows how it may be applied using Linux, Java and MiniSQL.

In the beginning, there were mainframes. Every program and piece of data was stored in a single almighty machine. Users could access this centralized computer only by means of dumb terminals. (See Figure 1.)

Figure 1. Mainframe Architecture

In the 1980s, the arrival of inexpensive network-connected PCs produced the popular two-tier client-server architecture. In this architecture, there is an application running in the client machine which interacts with the server—most commonly, a database management system (see Figure 2). Typically, the client application, also known as a fat client, contained some or all of the presentation logic (user interface), the application navigation, the business rules and the database access. Every time the business rules were modified, the client application had to be changed, tested and redistributed, even when the user interface remained intact. In order to minimize the impact of business logic alteration within client applications, the presentation logic must be separated from the business rules. This separation becomes the fundamental principle in the three-tier architecture.

Figure 2. Two-Tier Client-Server Architecture

In a three-tier architecture (also known as a multi-tier architecture), there are three or more interacting tiers, each with its own specific responsibilities (see Figure 3):

Figure 3. Three-Tier Architecture

  • Tier 1: the client contains the presentation logic, including simple control and user input validation. This application is also known as a thin client.

  • Tier 2: the middle tier is also known as the application server, which provides the business processes logic and the data access.

  • Tier 3: the data server provides the business data.

These are some of the advantages of a three-tier architecture:

  • It is easier to modify or replace any tier without affecting the other tiers.

  • Separating the application and database functionality means better load balancing.

  • Adequate security policies can be enforced within the server tiers without hindering the clients.

Putting the Theory into Practice

In order to demonstrate these design concepts, the general outline of a simple three-tier “Hangman” game will be presented (check the source code in the archive file). The purpose of this game, just in case the reader isn't familiar with it, is to try to guess a mystery word, one letter at a time, before making a certain number of mistakes.

Figure 4. Hangman Client Running in Windows 98

The data server is a Linux box running the MiniSQL database management system. The database is used to store the mystery words. At the beginning of each game, one of these words is randomly selected.

At the client side, a Java applet contained in a web page (originally obtained from a web server) is responsible for the application's graphical user interface (see Figure 4). The client platform may be any computer with a web browser that supports applets. The game's logic is not controlled by the applet; that's the middle tier's job. The client only takes care of the presentation logic: getting the user's input, performing some simple checking and drawing the resulting output.

The server in the middle tier is a Java application, also running within a Linux box. The rules of the “Hangman” game (the business rules) are coded in this tier. Sockets and JDBC, respectively, are used to communicate with the client and the data server through TCP/IP.

Figure 5. Diagram of Hardware Nodes

Figure 5 presents a UML (Unified Modeling Language) deployment diagram that shows the physical relationship among the hardware nodes of the system.

Even though the design described gives the impression of requiring a different machine for each tier, all tiers (each one running on a different process) can be run in the same computer. This means the complete application is able to run in a single Linux system with a graphical desktop, and it doesn't even have to be connected to the Net!

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

awesome article

amila's picture

This is quite simple and completed, understandable awesome article.
thanks for publishing. I have removed my one of my misunderstanding about 3 tier architecture reading this. (actually this article + wikipedia done that)
Thanks again and keep it up

thanx so much for the simple

Anonymous's picture

thanx so much for the simple yet valuable info

firoz, orionis

3-tier Architecture Comment

Purushottam Choudhary's picture

Very Good Article on 3 tier Architecture.

Good Article on 3 tier

Anonymous's picture

Good Article on 3 tier Architecture.

Comment

Rita dsouza's picture

You are very idiot in whole world asking for such comment,
Blodyfool,nonasense,donkey,silly monkey,pig,,,,,,,,,,

it is best sample of

Anonymous's picture

it is best sample of three-tier keep it up..
nice one.

Comment

Rita dsouza's picture

You are very idiot in whole world asking for such comment,
Blodyfool,nonasense,donkey,silly monkey,pig,,,,,,,,,,

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState