Layers

Monday, 11 September 2000
How does a 3-tier architecture work? What goes where? I got these questions last week, at the start of a new project. Here are the answers, a personal point of view:

The 3 layers

1. The GUI layer

The GUI is the "top layer". It contains all things that are visible to the user, the 'outside' of the system, such as screen layout and navigation. The GUI layer has techniques like HTML, CSS, Applet, Servlet, JSP, JHTML.

2. The Object layer

This is the core of the system, the linking pin between the other layers. The object layer has knowledge, in two different ways:
  1. runtime values, like the customer name "Oxford & Associates" or the invoice number "OAA2000w36".
  2. Structural knowledge, about data and processing.
    Data example
    A customer can receive many invoices, and an invoice always goes to just one customer.
    Proces example
    Know who does what. Every objects knows his own methods, and those of his neighbours. In a pure OO model an object talks to his neighbours, and nobody but his neighbours.
In the object layer you'll find things like Classes, objects, instance variables, vectors, primitives, methods, polymorphism, encapsulation and inheritance. The objects mostly have a temporary nature. They "live" just in memory for the duration of a transaction or session.

3. Database Layer

The database layer takes care of persistency. An object from the object layer can write itself to one or more tables. In the database layer you'll find things like database, connection, table, SQL and result set.

Advantages

  • With the right approach the 3-tier architecture saves development manpower. Code each bit only once, with powerful reusage.
  • Divide and conquer strategy. Every layer is rather easy to develop. Better have 3 simple parts that one complex whole.
  • Quality. For each layer a specialist can contribute specific expertise, a GUI Designer for the user interface, a Java programmer for the object layer, and a Database Designer for the tables.
Till next week!
Nut
Born on 9 sep 2000: Mats Joost Rutger Hage (home.planet.nl/~hage0000). Congratulations to my cousin Ester!