Architecture N-Tiers

Client tier, Business tier, Persistence tier, ...

Table des matières :

Overview

The application design is generaly divided into multiple tiers.

Indispensable Tiers :
  • the Client tier,
  • the Business tier,
  • the Persistence tier
There are other tiers :
  • the Web tier,
  • the Enterprise JavaBeans tier
  • the Enterprise Information System (EIS) tier
These tiers are not arranged hierarchically. Each tier may communicate directly with other tiers, or indirectly by way of intermediate tiers. Partitioning a design into tiers allows designers to choose the appropriate technology for given situation. Multiple technologies can even be used to provide the same service in different situations. For example, HTML pages, JSP pages, and stand-alone applications to all be used to create in the client tier. Each of the tiers plays a specific role in the design.
Keep in mind that a partition (tier, pattern, ...) are conceptual, and do not necessarily map directly onto implementation details such as database schema or class hierarchies.

The Client tier

The Client tier is responsible :
  • for presenting data to the user,
  • interacting with the user,
  • communicating with the other tiers of the application.
The Client tier is the only part the application the user ever sees. it may communicate with other tiers by :
  • XML messages / HTTP-HTTPS protocol
  • RMI / IOOP protocol
  • other...
If there are messages generated in XML, we can considered it and the code to process the XML messages part of the Client tier.
The Client tier communicates with other tiers by way of well-defined interfaces.
Future new clients can be written using technologies or languages that do not yet even exist, since they must conform only to the interface for communicating with other tiers.
Clients in the Client tier usually contain one or more Views of the MVC design.

Thin / Fat clients :
  • "thin" clients tend to limit themselves to View functionality,
  • "fat" clients can include Controller and even Model functions.
When designing an enterprise application, you should pay attention to handling multiple types of client interactions. The overall application design should support each new type of client with minimal additional effort. It should also avoid duplicating code either by sharing the application objects among multiple clients, or by reusing them through encapsulation, delegation, or inheritance.

The Business tier

It is a simpler part of Enterprise Javabeans tier.
Focusing on business functionality. Separates application-specific business logic from the details about how system-level services are implemented.

The Persistence tier

It is a simpler part of Enterprise Javabeans tier.

The Web tier

The Web tier is responsible for performing all Web-related processing, such as serving HTML, instantiating Web page templates, and formatting JSP pages for display by browsers.

The Web tier can :
  • cache model data (and updating it from the Model when necessary)
  • interpret user inputs,
  • select appropriate Views based on application flow,
  • manage database connections
Some objects within the Web tier act as proxies to components in the Enterprise JavaBeans tier.
If we wish to communicate with the application using non-Web technology (such as CORBA), we might not use the Web tier at all.

The Enterprise JavaBeans tier

The Enterprise JavaBeans tier is responsible for any processing involving Enterprise JavaBeans. Enterprise JavaBeans are software business components which extend servers to perform application-specific functionality. The interface between these components and their containers is defined in the Enterprise JavaBeans specification. Typically, server vendors implement the server and the Enterprise JavaBeans containers, as well as tools for deploying Enterprise JavaBeans into those containers. The containers provide services to the Enterprise JavaBeans instances they contain: controlling transactions, managing security, thread or other resource pooling, and handling persistence, among other high-level system tasks. Application developers can then write Enterprise JavaBeans components, focusing on business functionality, and deferring complex implementation issues to their containers. Essentially, the Enterprise JavaBeans tier provides a component model for access to distributed system services and persistent data. Both stand-alone clients and Web applications in the Web tier can use Enterprise JavaBeans components hosted by the Enterprise JavaBeans tier. The Enterprise JavaBeans tier separates application-specific business logic from the details about how system-level services are implemented. This separation decouples the role of application developers (who focus on application functionality) from that of application deployers (who configure the system for efficient access to resources). It also simplifies application component development, because details about system issues such as persistence, reentrancy, transactions, remote access, and so on, are all handled by the container.

The Enterprise Information System (EIS) Tier


The Client Tier : Type of application

A user's perception of an enterprise application is often closely tied to the behavior of the application's client tier. A client makes requests to the server on behalf of the user, and presents the outcomes of those requests to the user. Therefore, it's important to choose a client configuration that best addresses the requirements of the application and empowers the user with a rich interface.
The task of designing and developing the client tier of an n-tier Web architecture often challenges developers. This is particularly true in the Web world, where the sheer variety of servers, deployment platforms, and protocols turns the challenge into a headache. A client-tier architect must address a number of questions:
  • How should I structure my GUI?
  • How will users interact with my GUI?
  • How should I separate server-side/transport data formats from my GUI?
  • How should I provide sound mechanisms for event management, application flows, and widget control?
The J2EE platform supports many types of clients. A J2EE client can connect across the World Wide Web, or inside an enterprise's intranet. Clients can run on hardware ranging from powerful desktop machines to tiny wearable assistants. They can provide a browser-based or stand-alone interface. A client can communicate with, and use the services provided by, one or more tiers of the enterprise application. Clients can also be written in a number of languages and use a variety of development environments.
Since client software executes on user systems, it can be hard to control aspects of the client environment such as hardware, operating system platform, and browser version.

Client / server partition :
  • The more functionality you keep on the client (closer to the user), the better perceived quality of service the user gets.
  • The more you provide on the server, the easier it is to distribute, deploy, and manage the application.

Application type available

Concepts to consider to make a choice

4 concepts :
  • Operating Environment
  • Deployment / Launch
  • Possibilities
  • Implementation

Operating Environment :

Whether the client will be deployed inside a company intranet or in the Internet determines many aspects of the client. Virtual private networks (VPNs) and extranets have characteristics that are a hybrid of Internet and intranet characteristics.
  • Quality network service : higher and less variance for Intranet / non constant for Internet (dialup telephone lines, cable modems, DSL, or other...).
    • Bandwidth
    • Latency
  • Security / Firewall : The Internet and intranets have different security constraints.
    • Firewall : clients that need to connect over the Internet must be designed to be able to talk to servers that are often behind firewalls. Possible protocols : HTTP / HTTPS (IIOP can supported but with many difficulties in certain case).
    • Security : Within an intranet, the client and server may be in the same security domain, and can integrate with the environment better in terms of security.
    • Confidentiality : confidentiality must be ensured if the communication occurs over the Internet. In this case, its necessary to use a protocol that can ensure confidentiality, such as HTTPS.
    • Protocols support : HTTP / HTTPS / RMI-IIOP

Deployment / Launch
  • Installation : The delivery vehicle for the client software.
    With a web application there are not installation. With JavaWebStart, the installation is automatic but required download the first time.
  • Upgrade : The roll-out and upgrade strategy / How often the client needs to be upgraded.
    With a web application upgrade client is the same that upgrade server. JavaWebStart has many options for automatic update.
  • Loading time : The first time we use Java application, we must download the jar file, but after all components are local.
  • Client-server traffic after loading : With Java application, only data are transmitted. With Web application data and presentation are transmitted.
  • Local cache : Optimize network traffic. JavaWebStart can keep local cache.
  • Use offline : Do we want use application offline (without network). We can use an web application only in connected mode. JavaWebStart allows off-line operation.

Possibilities
  • Heavy interactivity : A web application is not made to have heavy interactivity. It is made primarily for transactional operations.
  • Response time : A web application is not made to have short reaction times.
  • Controlled layouts
  • Multi-languages




Article extrait du site Loribel.com.
https://loribel.com/java/topics/ntiers.html