JaVa
   

Web-Tier Design Goals

Enough negatives: what features should a good web interface have? The following two goals are central to maintainability and extensibility.

A Clean Web Tier

As JSP Model 1 experience shows, a web app is doomed to failure if markup generation is inextricably mixed with control flow and business object invocations.

Important 

A clean web tier separates control flow and the invocation of business objects (handled by Java objects) from presentation (handled by view components such as JSP pages).

Java classes should be used to control flow and initiate business logic. Java classes should not be used to generate markup. It should be possible to change presentation markup without modifying Java classes. JSP pages - or whatever templates are used - will contain only markup and simple presentation logic. This permits an almost complete separation of Java developer and markup author roles.

A Thin Web Tier

However, achieving a clean web tier is not enough. It's also vital to ensure that the web tier is as thin as possible. This means that the web tier should contain no more Java code than is necessary to initiate business processing from user actions, and display the results. It means that the web tier should contain only web-specific control logic (such as the choice of the layout data should be displayed in) and not business logic (such as data retrieval). Why is this so important? apps in which business logic is tied to the webtier - even web tier Java objects such as servlets, rather than JSP pages - fail to meet the goals we identified in . Such apps:

Important 

In a well-designed J2EE app, the web tier should be a thin layer built on well-defined business interfaces. It should be responsible only for translating user actions into app events, and the results of processing user input into results displayable by the web interface.

This point deserves to be emphasized. Although a thin web tier is as important as a clean web tier, the relationship between web tier and business objects seems to get far less attention than the MVC approach to ensuring a clean web tier.

JaVa
   
Comments