Solved

two-tier vs. three-tier - first and easy quesy !

Posted on 2002-06-02
6
338 Views
Last Modified: 2010-03-31
Hi

This is my first question in this forum. I am trying to design a web-based database system and studying the difference between wo-tier vs. three-tier applications in Java. I came across the following statment in page 26 from George Resse's famouse book: database programming with JDBC and java. He says:

Two-tier, fat-client systems are notorious for their inability to adopt changing environment and scale with growing user and data volume. Even though a client’s primary task is the presentation of data, a fat client is loaded with knowledge completely unrelated to that task.
What happens if some small bit of business logic changes?
you have to modify, test, and redistribute a client program whose core functionality has nothing to do with the changes you made.

End of section


What I don't understand here is
Two-tier, fat-client systems are notorious for their inability to adopt changing environment and scale with growing user and data volume. Even though a client’s primary task is the presentation of data, a fat client is loaded with knowledge completely unrelated to that task.

What he ment by <<<the changing environment and scale with growing user and data volume.>>> ?

and
and also what he ment by <<<Even though a client’s primary task is the presentation of data, a fat client is loaded with knowledge completely unrelated to that task>>> ?


I appreciate any help. Thankyou

Paris_France
0
Comment
Question by:Paris_France
6 Comments
 

Expert Comment

by:0xDEADBEEF
Comment Utility
<<<the changing environment and scale with growing user and data volume.>>>

The longer a database exists, the more data gets stored in it, usually. This means that the client has to deal with more data, which will take longer.
Now, the way the amount of time needed grows with more data is called scaling. The more data there is, the more important good scaling gets.
For example, the bubble sort algorithm scales rather bad (o(n^2)), while the quicksort algorithm scales quite well (o(n*ln(n)).

This o(..) stuff just visualizes proportions. o(n^2) means that twice the amount of data will take 2^2=4 times as long. Quicksort only takes 2*ln 2 ~= 1.38 times as long.

It's basically the same with a growing number of users, since there will be more requests to the database.

<<<Even though a client’s primary task is the presentation of data, a fat client is loaded with knowledge completely unrelated to that task>>>

I guess he wants to say that a program should do what it's meant to do, and as little as possible more. In case you want a list of names and addresses, the client shouldn't obtain the whole database and filter the information afterwards, but rather ask the database to filter the infortmation and get it then.
0
 
LVL 1

Expert Comment

by:howesd
Comment Utility
<<<Even though a client’s primary task is the presentation of data, a fat client is loaded with knowledge
completely unrelated to that task>>>

My opinion on this is that he's saying the presentation layer should just present the data to the user - it shouldn't know anything ( or not a great deal ) about the data which it actually displays.

As a clumsy example, suppose you had an application which retrieved data from a database and displayed it. Also suppose that the database held coded data - a status column being an obvious example. Possible values could be
A - Active
B - Bad Debt
D - Dead
I - Inactive.

If you have a two tier architecture, your client would need to know what the status column decoded to, so you'd have to write a conversion routine to convert these values. That's not too much of a problem, but what would happen if you had to develop another interface that was going to run alongside your existing interface ( a Business 2 Business interface for example )? In the two tier model you'd need to build the conversion routine in to each of the client applications which is boring to do and will leave you with a long term maintenance cost if the values in the database change over time.

If you are using a 3 or more tier approach, the conversion routine lives in the "middle" tier(s) - the clients request the data, the "middle" tier(s) serve it up, complete with any relevant conversions or computations, and the clients just display it.

The business logic is centralised in one place and the presentation layer can concentrate on doing its job with out worrying about what the data actually means.

Dave
0
 
LVL 2

Expert Comment

by:triso
Comment Utility
Hi,

I'll comment on this part of your question: "What happens if some small bit of business logic changes?"

Well if the calculation for "sales tax" changes from 5% to 7% and that logic is in our "fat client" then the software on every client has to change.  However if that logic is in the middle tier then only that tier has to change; which is effortless compared to changing all clients.

I hope that's clear.


0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Paris_France
Comment Utility
Thanks to you all

 0xDEADBEEF :-

<<<Even though a client’s primary task is the presentation of data, a fat client is loaded with knowledge
completely unrelated to that task>>>

Your above comment is exactly what I understood and where I got confused .To clrify please you said :

"a program should do what it's meant to do, and as little as possible more"

If I understand you well this is not a good thing. For example, if I want to search for one record in the database, the database will give me all records and then I have to filter them my self thru my program ! Is that what you wanted to say? Then what is the role of the database ?
Usually the database gives you ONLY what you want. It does the filtering for you.

In case of a Java-based application, fat client this procedure will fill the memory quickly even if you search for one record. Right?

Thanks again

0
 
LVL 1

Accepted Solution

by:
howesd earned 50 total points
Comment Utility
I don't think I agree with what 0xDEADBEEF says on this - the issue of multiple tiers doesn't come down to how the database returns records to the client, it comes down each tier in the application only doing as much work as it needs to. So, the presentation tier knows how to take information which is passed to it and present it to a user. It knows how to manipulate things like list boxes. What it doesn't need to know is how the information which it presents is physically stored in a computer. It doesn't even know whether the data is stored in a database, let alone what the names of the tables are. Similarly, the middle tier knows all about what the data in a system means, and what are valid conditions for the data, but knows nothing about how it is to be presented to the user or how it exists on a database. The data services know about the physical representation of the data, but very little else. That's what I believe the essence of n-tier systems to be.
0
 

Author Comment

by:Paris_France
Comment Utility
Ok here is what George Reese said when he read my and 0xDEADBEEF  comments:

No, none of that is what I mean.

What I mean is that a fat client is a client with processing unrelated to presentation.
In other words, even though a client’s primary task is the presentation of data, a fat client chooses to burden itself with logic completely unrelated to the task. Sorting and filtering are not what I am talking about; I am talking about business logic.

The problem is basically that when you introduce business logic into the client layer, you are introducing logic that is not user-dependent (in other words, shared) into code that is user-dependent (personalized for the user).

Let’s take the simple example of interest calculation. The Swing UI you write exists to provide the user with an interface into the system—it is not the system itself. The calculation of interest, however, is a business rule that is part of the system and does not change no matter how the user is interfacing with the system. Let’s imagine you have ten different interfaces—a Swing UI, a JSP page, a PowerBuilder app, etc. And let’s imagine the rules governing interest calculation change. You have to go make changes in at least 10 different places before your business systems reflect the change in rules. Thus as the number of users increases (and thus likely the number of ways for a user to interface with the system), the more difficult it becomes for a two-tier system with business logic in the client to scale to accommodate the increasing number of users.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now