N-Tier web applications

<< Click to Display Table of Contents >>

Navigation:  Developer's Guide > Best Practices >

N-Tier web applications

N-tier applications are layered applications where each layer should only know and access the layer immediately below it. This approach provides many advantages, even for monolithic applications like a VCL application using an embedded database server.


However, when the layers are physically separated it is even better. A typical 2-tier application is a client/server VCL application connected to a shared database server. In this case, both tiers are clearly identifiable and separated.


Creating the equivalent uniGUI web application will automatically create a 3rd tier, physically running in the browser, dynamically created and transmitted to the client browser from the uniGUI application.


The developer must be aware of that physical separation between the presentation layer and the business layer (no matter how good it is concerning Object Oriented Design). In the new application, some code runs on the client, while other code runs on the server. There are client-side events, server-side events, and dynamic AJAX requests coming from the client which must be answered by the server.


A very important difference is the asynchronous character of the typical web application. The server application dynamically renders the client web page and wait for client events from all sessions; it is not supposed to wait in a message loop for a particular session as VCL applications do.


It is even more important to know about how to interact with huge amounts of data (in the end, most of these applications need a shared database server on the back-end).