JaVa
   

Web-Tier MVC Design

Overview

In this chapter we'll look at web-tier design and how to ensure that a web interface is a simple and maintainable layer built on business objects and overall app infrastructure. This is a very important topic. A poorly designed web interface is one of the quickest paths to an unmaintainable app and overall project failure. Experience with poorly designed web interfaces that proved hugely expensive in development effort and business opportunity first made me passionate about J2EE design. After surveying the problems we seek to avoid in web app design, we'll focus on the MVC architectural pattern, which has proven the key to writing successful web interfaces. After examining MVC theory and the concepts shared between successful implementations of the MVC pattern, we'll look at three open source MVC web app frameworks: Struts, Maverick, and Web Work. We'll then look at the design and use of a simple but powerful web app framework integrated with the infrastructure that I introduced in the last chapter, and which we'll use for the sample app. Like the infrastructure components we've seen so far, this framework is intended for use in real apps, and not merely as a demo. I chose to implement this framework rather than use an existing framework for several reasons:

Naturally, this framework builds not only on my experience, but also on the concepts used in existing frameworks. It borrows some concepts from Struts and Maverick, in particular. We'll also look at the issue of session state management and data validation in web apps.

Finally, we'll look at implementing the web tier of the sample app using the MVC framework discussed in this chapter, paying special attention to how web components access business objects.

JaVa
   
Comments