Nannette Thacker ShiningStar.net

ASP.net Web Application Development

Sponsors

News

See all Blog Posts by Nannette.

Nannette Thacker, consultant and owner of Shining Star Services LLC, specializes in development of custom dynamic database driven web applications utilizing ASP.net technologies. Nannette has been developing ASP sites since 1997. Nannette has written numerous articles on web development techniques and tutorials.

Nannette is the owner and developer of ChristianSinglesDating.com.

 Subscribe in a reader





View Nannette  Thacker's profile on LinkedIn

3-Tier Web Application Development

By Nannette Thacker

In web application development, three-tier architecture refers to separating the application process into three specific layers. What the user sees via a web browser is called the presentation tier and is content served from a web server. The middle tier performs the business logic processing that occurs, for example, when a user submits a form. The back end consists of the data tier which handles the database processing and access to the data. We'll take a simplistic look at each of these.

Presentation Tier

The Presentation Tier or User Interface is the portion the user sees when they open a web page in the browser. It is as simple as you reading this article all the way to searching a catalog and purchasing a product using a shopping cart. It is what is presented to the user on the client side within their web browser.

If you were to view the source code, you would only see code such as HTML, Javascript, and Cascading Style Sheets. On some sites, you may see Java Applets and Flash. Viewing source code on a web page, you would NOT see database queries or loops or calls to classes or any behind-the-scenes processing.

In ASP.net and utilizing Visual Studio or Visual Web Developer, developers can separate the user interface from the business logic and data access layer with various tools.

ASP.net allows using MasterPages to setup the site look and feel. As well, when creating a WebForm which utilizes the MasterPage, you may create it and allow the code to be placed in a separate file, known as codebehind, thus keeping your business logic in a separate layer from the look and feel.

You may also setup the site design using Themes, Skins, and Cascading Style Sheets.

Languages used in this layer are typically HTML, DHTML, CSS and javascript.

Business Logic or Application Tier

The Business Logic, Functional Process Logic, Business Rules (all pertaining to the same thing), are kept in a separate layer. In ASP.net, this is where you define your classes and source code. This can be in the App_Code folder for your classes and methods. Web languages typically used in ASP.net are VB and C#. You would not use HTML or Javascript in this layer. In this layer you typically define your classes, functions, sub procedures, properties, etc.

Data Access Tier

In ASP.net, the Data Access layer is where you define your typed datasets and tableadapters. It is where you define your queries or stored procedures. The business tier may then make use of this functionality. In your classes, rather than defining ad hoc queries, you may use a TableAdapter to access the Data Access Layer.

An Example

As an example of how this works, let's assume you are creating a web page that allows the user to enter information which you wish to then enter into a database. You first create a dataset and tableadapter that allows insert into the table, either by a query or stored procedure. This is your data access layer.

You then create a class, which retrieves the information from the form, checks for field validations and then uses the tableadapter to send the data to the database.

You create a web form, which can use a GridView control or other controls to allow the user to input the data into the web form. In the codebehind of the web form, you handle the submit button click event, and send the data from the form to your class, which sends the information to the database using the tableadapter.

Benefits

When utilized properly, using a multi-tier architecture improves performance and scalability. If a web page needs an update or redesign, all of this may be handled by altering the CSS and HTML, without affecting the business or data logic. Any of the three tiers may be replaced or upgraded individually without affecting the other tiers. For instance, if you change the database on the back end, it wouldn't affect the presentation or business logic tiers, other than changing the database connection.

This is a simple introduction to the three-tier web architecture, but I hope it has helped you understand the layers of a multi-tier architecture.

May your dreams be in ASP.net!

Nannette Thacker

Comments

suman r said:

thanks for the info

# June 30, 2008 11:04 AM

Dave said:

Great article.  Thank you for giving a birds eye view of the tier topology.

*kudos*

# July 2, 2008 10:18 AM

Victor said:

Short and clear! THX

# August 28, 2008 5:50 PM

Karwan said:

Hi Nannette,

Thanks very much, its brief and benefitable.

Regards

# October 7, 2008 8:01 AM

Hina said:

Thank you Nannette.  You have explained 3-Tier Web Application Development clearly and I have found it to be very useful.

# October 24, 2008 10:47 AM

fastcoder said:

Its great. Thank you for very clear idea.

# April 27, 2009 12:40 PM

Chris said:

This article has really helped with a project I am doing. Thank you so much

# July 12, 2009 8:10 PM

Lorrie said:

Thank you for writing and posting this article.  It cleared up some new terminology I've seen used in job descriptions as I'm searching for a new position.

# September 3, 2009 11:34 AM

RJ said:

Good article but let's get deeper.

Tiers and Layers are often used interchangeably. However if you really want to propose a better architectural understanding note:

- LAYER -> Logical Structure Solution (File System).

- TIER -> Physical Structure Solution (Server).

Therefore, Presentation, Business Logic and Data Access referred as TIER bring the understanding of having each operating from individual servers while LAYER accept many other architectural patterns structured within them such as MVC (Model-View-Controller), SOA (Service Oriented Architecture), EDA (Event Driven Architecture).

In complicated scenarios and advanced solutions you could implement:

Multitier Architecture (3-tier):

- Server 1 -> Business Logic Tier:

  (hosting) - BLL (Business Logic Layer) = Event Handlers, Controllers, Webservices(REST, SOAP).

- Server 2 -> Data Access Tier:

  (hosting) - DAL (Data Access Layer) = Models, Webservices (Data Interchange).

- Server 3 -> Presentation Tier:

  (hosting) - UIL (User Interface Layer or Presentation Layer) = Presentation, Views, Webservices (Response).

3 enterprise servers (TIERS) connected in the same Local network for response time performance plus 1 logic LAYER in each for load balance performance.

My explanation samples is based on the difference between TIER and LAYER as infrastructure not the mentioned architectural patterns and all its layers composition.  

Hope this expands horizons.

Cheers!

RJ

# November 1, 2009 9:37 PM

mohammed imran said:

its good but as an example ur missing the pratical part only theory is available over here

# December 17, 2009 2:06 AM

Pawan said:

Hi

Please write an small application with 3 tier approach with explanation

this is request from me

It will help new budding programmer

thanks

# January 26, 2010 3:54 AM

rajesh said:

its so good

its so easy to understand but only theory part is available

# March 18, 2010 1:28 AM

Vacciph said:

Thanks Thacker, your article is really very helpful.

thanks,

vac

# April 2, 2010 1:32 PM

mit chauhan said:

nice tutorial but it could be better if u write an example with this ..

# May 26, 2010 8:19 AM

ritesh said:

hi

thakyou for explane the 3 tier ...

# May 26, 2010 8:57 AM

Reema Panikkassery said:

Thanks! It Helped me a lot

# June 19, 2010 1:47 AM

contus said:

Hi Great post i'll be definitely come back to your site. keep this nice work  

# January 22, 2011 1:31 AM

jatin.nahar said:

for easy understanding of three tier architecture you can check this website also.....

www.three-tier-architecture.blogspot.com

# March 31, 2011 1:46 AM

jhon275 said:

it's very useful.

thanks

# May 13, 2011 10:44 PM

Ramesh said:

I want to create a new web application with 3 Tier. Please tell me how to start.

# May 23, 2011 8:21 PM

Khalid Nobani said:

Thanks for article ...

# July 19, 2011 4:22 AM

rtyecript said:

I really liked the article, and the very cool blog

# August 21, 2011 6:11 PM

Mohd.Muqtdeer said:

This is good description in brief and i understand very well.i want to develop an application in 3 tier architect so please give me an article or any advice how it should be start

# September 7, 2011 5:51 AM

Venkat said:

A TIER CAN HAVE ONE OR  ANY NUMBER OF LAYERS.

# September 27, 2011 11:54 AM

Alvizouri said:

This topic is so interesting because I think it's easier and better than MVC model. My question is? How to organize all those files and folders?

# November 3, 2011 11:24 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)