Chapter 12: 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 application infrastructure.

This is a very important topic. A poorly designed web interface is one of the quickest paths to an unmaintainable application 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 application 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 application frameworks: Struts, Maverick, and Web Work. We'll then look at the design and use of a simple but powerful web application framework integrated with the infrastructure that I introduced in the last chapter, and which we'll use for the sample application. Like the infrastructure components we've seen so far, this framework is intended for use in real applications, and not merely as a demo.

I chose to implement this framework rather than use an existing framework for several reasons:

  • To demonstrate the potential to integrate an MVC web application framework into an overall application infrastructure, and the benefits that this brings.

  • To formalize the relationship between web-tier components and business objects, which are independent of the web interface. I feel that the relationship between web-tier components and business objects is often neglected in MVC applications, with too much application code being web-specific.

  • Because I have considerable experience in this area and have implemented previous production frameworks, from which this is a natural evolution.

  • Because no existing MVC web framework meets all the design goals we will discuss.

  • Because the design of this framework clearly illustrates the MVC concepts central to this chapter, and especially the complete decoupling of views from controllers. We'll see the benefits of this when we look at alternative view technologies in the next chapter.

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 applications.

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



Expert One-on-One J2EE Design and Development
Microsoft Office PowerPoint 2007 On Demand
ISBN: B0085SG5O4
EAN: 2147483647
Year: 2005
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net