This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Three or 4 Tier? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Three or 4 Tier?" Watch "Three or 4 Tier?" New topic
Author

Three or 4 Tier?

Farbod H Foomany
Ranch Hand

Joined: Feb 29, 2008
Posts: 63
Apologies for my very dumb question.

Is it called three tier or 4 tier?

Client Machine(Browser) --- Web Tier (JSP) --- Business Tier --- Database

Business Tier could be anything, for example EJBs. Or it may be proprietary code written in java that communicates with database using jdbc.

I thought it was normal three tier architecture, but sometimes it is called 4 tier.

Regards
Farbod
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
three-tier is synonymous with n-tier or multi-tier

Application code in a client application would be considered to be part of the Presentation tier. Code that creates HTML for a web browser is also part of the Presentaion tier. A Web container/server that produces HTML for a browser is part of the Presentation tier.

The code of the browser (Explorer or Netscape) which resides on client computers is not part of the application.
[ April 21, 2008: Message edited by: James Clark ]
Farbod H Foomany
Ranch Hand

Joined: Feb 29, 2008
Posts: 63
Thank you James,
You elaborated on presentation layer. That was good.
Are you sure that multi-tier and three-tier could be used interchangeably? What about layer? You call it three layer or 4 layer?

Some people even call this 3 layer(tier) application:

Client -- Presentation -- Application Logic -- Data Access -- Database

Data Access layer receives data from application logic layer (which holds business rule) and send it to the database, based on the type of database.

Regards
Farbod
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
>You elaborated on presentation layer. That was good.

Thanks. To be concise, my elaboration was about the Presentation tier. I never called it a "layer." I never use the term layer in practice.

There is a difference between what a "tier" is and the physical location of a group of nodes. Tier in the Java EE Reference Architecture is a design concept. The term "three-tier" translates into Presentation, Business and Integration tiers. There are three of them. There can be hundreds of nodes. The design is still referred to as three-tier. Some individuals use the term multi-tier.

Since I don't use the term layer I can't speak on it.


-- Presentation -- Business -- Integration --

You might consider that on the Business tier, there are layers. There may be a business logic layer and a data access layer in the Business tier.

You might consider that on the Presentation tier, there are many layers. There may be a presentation data model, Swing GUI, Java Server Pages, UI components, WAP servlets, etc.

The Integration tier also may have layers. The might be enterprise legacy systems written in COBOL, relational databases, file systems, Web services, etc. There may be a layer of JCA adapters that enable communication between the Business tier and EIS applications.

Hope this helps.
[ April 21, 2008: Message edited by: James Clark ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
My impression is that the terms "tier" and "layer" are used interchangeably.


Ping & DNS - my free Android networking tools app
Farbod H Foomany
Ranch Hand

Joined: Feb 29, 2008
Posts: 63
Hi James,
and thank you again. Helpful comments.

As for Tier and Layer, I read some time ago that layer refers to logical partitioning as tier refers to physical. So if you have each layer on one server, you can call them tiers. From then, I use this convention and I know it is popular. But your description makes sense too, and I know except in rare cases it is compatible with this convention.

So let me go back to my example. I call all those terms layers. OK? so I have Presentation layer -- Application Logic layer -- Data Access layer -- Database layer

If I am right, you mean that Data Access layer and Database layer here, are parts of Integration tier in your terminology. Am I right? similarly Application Logic layer falls into Business tier and Client and Presentation layer, build Presentation Tier.

So we won't have 4 tier at all? will we?

Also, if I have a JSP talking directly through JDBC to database, in SQL language, is it still three tier? I would say no, but look at for example Sang Shin's online course, J2EEOverview_speakernoted.pdf, page 21
http://www.javapassion.com/j2ee/J2EEOverview_speakernoted.pdf
it implies such a thing is still three tier.

Also what do you answer to the question of advantage and disadvantages of multi-tier over three tier?

Thank you again.
Regards
Farbod
Farbod H Foomany
Ranch Hand

Joined: Feb 29, 2008
Posts: 63
Thank you Ulf. Hope you and other people participate.
I think if we accept James explanation, Tier refers to concepts. What is the function of all these THINGS, presentation ? So they are part of Presentation Tier. Establishing the business logic? So we can call them a Buiness Tier, accessing to database, etc, so they are part of Integration Tier... No matter they are on one node, or billions, clustered, ... .

Not everyone shares this. you can find so many pages searching 'difference tier layer', see for example this:
http://www.arcware.net/archive/2004/06/14/285.aspx

(Microsoft uses layer more frequently if I am right. Oracle has its own terminology. for example look at MVC and ADF model. Do you agree that model-view-controller for example in ADF all fall in Presentation Tier?, ok let's keep it simpler, forget the text in the bracket)

Regards
Farbod
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Thanks Farbod.

The Internet today allows individuals and organizations to publish information with very little governance and regulations. It is getting easier and easier to put stuff on an Internet web page. However, not all technical information that is on Internet web pages is accurate. I am not an expert, but I have seen very fancy, nicely done web pages about software development that contains incorrect information. There is no way to prevent this, so the best strategy is to favor published printed material that has been professionally edited and is published by a reputable publishing company, e.g. Addison Wesley, O'Reilly, McGraw Hill

The three-tier model that I describe above is from the Java EE Reference Architecture created by Sun Microsystems(see ref below).

The data access objects (layer) are/is part of the Integration tier. The business objects communicate with the data access objects to send and receive data from the Integration tier.

> So we won't have 4 tier at all? will we?

There is no fourth tier. There is a Presentation, Business, Integration tier.

> Also, if I have a JSP talking directly through JDBC to database, in SQL language, is it still three tier?

No. This design is not in accord with the three-tier programming model from the Java EE Reference Architecture.

> Also what do you answer to the question of advantage and disadvantages of multi-tier over three tier?

See above.

* Sun Certified Enterprise Architecture for J2EE Technology Study Guide (Sun Microsystems Press) ISBN-10: 0130449164
[ April 22, 2008: Message edited by: James Clark ]
giuseppe fanuzzi
Ranch Hand

Joined: Sep 18, 2006
Posts: 99
hello folks
Tier and layer are similar concepts in the real life, but different in j2ee world.
Every application is a set of "roles" that some components have to play.
There is a gui or a browser that wants to connect with your application.
There are pages to show your data and the controller that accept your request.
There's the core of the application that knows how execute your order, the business logic
there are components that speak with the db
finally there's the db

Now imagine Tier like "role" that some component of your application play.

the client tier (gui applications, browser, and so on)
presentation tier (jsp, servlet, business delegate)
business tier (session bean, entity bean, business objects)
Integration tier (Data Access Object, jdbc, j2ee connector, and so on)
Resource tier, or Resource tier (DB, legacy systems)

if you have one jsp that execute a query and shows the result (it's an oscar actor) then that page is playing presentation,business and integration role, but a serious film have different actors

Layer is a part of a subsystem that encapsulates an exact functional (business) responsibility and that collaborates with other next layers.
A layer is about business, tier is about architecture


GiUsEpPe (SCJP, SCWCD, SCBCD, IBM OOAD, SCEA/OCMJEA 5)
Gabriel Claramunt
Ranch Hand

Joined: May 26, 2007
Posts: 375
For me, layers always are from the logical system point of view and tiers are form the physical point of view. In UML, layers will visible be in the logical view and tiers in the deployment view.
The JEE 5 tutorial reference doesn't seem to help, because it maps the web and business tier into the JEE app server and states that form only one tier...

In that particular case, if you have the web tier in a separate server (or servers), you effectively have a 4 tier application.


Gabriel
Software Surgeon
Farbod H Foomany
Ranch Hand

Joined: Feb 29, 2008
Posts: 63
Thank you all. I still look forward to any comments.
James answer was consistent but I think we should be wary of other conventions.

As Gabriel said, I think Java EE Tutorial is sitting on the fence also however it calls all of them 'tiers', especially EIS tier. It says:
Although a Java EE application can consist of the three or four tiers shown in Figure 1-1, Java EE multitiered applications are generally considered to be three-tiered applications because they are distributed over three locations.
(http://java.sun.com/javaee/5/docs/tutorial/doc/bnaay.html)
I personally don't like this ambiguity. It makes mention of physical LOCATION, which is a bit irrelevant. My impression is that they favour four tiers idea.

I liked giuseppe's explanation, but thinking of a jsp having many tiers INSIDE, in fact, is a bit scary!

All were helpful although I think there is no strict convention here.

Thank you,
Best Regards
Farbod
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
I don't think physical location (i.e., servers) figures into this, at least not in the commonly used definitions for these terms. It doesn't make sense to call something an n-tier vs. an (n+1)-tier architecture depending on whether the web server and the app server run on the same machine.
[ April 23, 2008: Message edited by: Ulf Dittmer ]
Farbod H Foomany
Ranch Hand

Joined: Feb 29, 2008
Posts: 63
I agree. but 'java EE multitiered applications are generally considered to be three-tiered applications because they are distributed over three locations' implies so.
giuseppe fanuzzi
Ranch Hand

Joined: Sep 18, 2006
Posts: 99
In fact: 'tier' in not 'phisical'
If you have web-server, application server, and database in the same machine you have in any case 4 tier (presentation, business, integration and EIS), but "all in one phisical location"
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Sun's usage of the term "tier", as stated in their printed material for the SCEA exam (see reference above), is explicitly logical, not physical.

"Tier" may or may not be used in other contexts that may pre-date the usage above. However, in the context of Java EE applications, tier is generally understood to be logical not physical.

Just for fun, if an enterprise application is deployed on 25 nodes, would we call it a 25-tier application? This sounds goofy.

EIS systems are considered part of the Integration tier.
[ April 23, 2008: Message edited by: James Clark ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Three or 4 Tier?