This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi folks, I've a design question that I was wondering whether anyone could help me with? I'm trying to decide whether an application that I have should be described a 2-Tier or 3-Tier.
The application has the following setup:
Presentation Layer = Swing GUI
The Swing GUI communicates with the Business Layer using RMI. The Swing GUI is on one machine. Both the Business Layer and Data Layer are on another, single, machine.
I've Google'd about for descriptions of 2-Tier and 3-Tier applications and I seem to get different definitions in different places. So I can't come to a conclusion between these two descriptions of my application:
1) A 2-tier application with three layers.
2) A 3-tier application (obviously with three layers).
Is my Business Layer really a seperate tier? It is simple a single Java class that calls to directly to classes in my Data Layer. So it would not be possible to put the Business Layer on a separate machine (without modifying it to allow communication between the Business and Data layer over a network).
Data File (containing a simple list of records, so a single table) -> Data Manager (reads the data file) -> DAO -> DAOFactory
Joined: Apr 16, 2008
In the Computer Science field, the term "tier" traditionally has been used to describe a group of physical machines.
In regards to a traditional Client-Server application, you had a Fat-client component on the user's machine and a database component on a server machine. Here, the term two-tier still applied to the physical hardware (even though in reality there usually would be many, many client machines, not just one.)
Designers of the J2EE three-tier programming model, however, used the term "tier" to represent a logical design, not a physical design. In essence, you can build a three-tier application on a single CPU if you wanted. The term "tier" here is an abstract software concept, it does not represent hardware.
The J2EE three-tier model consisted of a Presentation tier, a Business tier and an Integration tier. It is typically used for describing large applications. However, for fun we can describe your little application as follows:
Presentation tier ----> GUI Objects
Business tier ----> Business logic objects which include data access objects
Integration tier ----> Data file on the file-system
Hi Jimmy, thanks for the explanation. You touched on probably the main topic that confused me. What constitutes a tier? When is a layer a tier? When is a layer not a tier? Is a layer always a tier?
Some descriptions I read said a tier had to be a physical distinction whereas others said it could be a logical distinction.
The descriptions that said it had to be a physical distinction also mention that you could have 3-tier with two machines (presentation on one machine, business + data layer on second machine). But, and a big but in my case, I read it must be possible to put the business and data layer on separate machines. Which is not possible with my current implementation.
In summary, would I be correct in understanding you would describe my application as 3-tier rather than 2-tier? Your reasoning being that a logical distinction is sufficient to call my business layer a separate tier?
Joined: Apr 16, 2008
In summary, would I be correct in understanding you would describe my application as 3-tier rather than 2-tier?
Hi Sean, Thanks. No, you would not be correct here. Your application really is too small to be described as having any "tiers", in the real-world. There is a size aspect as well to the term "tier."
However, for fun, in the context of describing the software design and describing how the software components are organized, yes your application can be described as a three-tier application. The important thing here is that there is a context. You are describing the organization of the "software."
In the English language, there are many conditions where information can be understood or interpreted in more than one way. Context usually is very critical element in resolving ambiguity or guiding interpretation. Hence, as always, a clear and sharp understanding of English is very important in software engineering.
Your Business tier contain multiple layers, e.g. (1) business logic layer, (2) data access layer, etc.
Jimmy Clark wrote:There is a size aspect as well to the term "tier."
I've read quite a few descriptions of 3-tier architecture and none mention size are being a prerequiste to using this architectural description. Size is a subjective term, so this sounds quite unusual to me. This implies that the use of 3-tier architecture as a description is a subjective one. At what point is the size too small - surely open to personal opinions.
When you mention size, what are you measuring? The number of entities? Something else?
Jimmy Clark wrote:The important thing here is that there is a context. You are describing the organization of the "software."
Let's talk in more concrete terms. If I take the starting point of "something is either 3-tier or it isn't 3-tier", why is this not the case?
Joined: Apr 16, 2008
Deciding to use the term "three-tier" to describe a design is a subjective decision. As an author, it is important to ensure that there is a clear context to your message. If there is no clearly understood context, readers may become confused.
Basically, if you are unsure about the understanding of your readers, it is best to define what you mean by the term "tier" and then go foward and describe your design.
Sun's J2EE three-tier programming model had nothing to do with the number of CPU or machines. A conforming application could be on 20 machines or 1 machine.
But English lessons aside. This is interesting, I've not yet read any explanation of a 3-tier architecture where it stipulates that in order for a system to be regarded as 3-tier that each tier must be composed of several groups of machines. I would be interested in reading about this further, have you a reference?
Joined: Apr 16, 2008
A three-tier logical software architecture design can be implemented using a singe CPU or multiple CPU. Here you are describing the organization of the software components, not the physical nodes.
Super, that sounds like many of the descriptions that I have read. So back to my original query and the application I outlined. It sounds like you would regard my application as being 3-tier from the perspective of a logical architectural design. Am I understanding you correctly?