ChapterÂ 3.Â Architectures
In this chapter we'll survey alternative architectures for J2EE applications, focusing on web applications. However, much of the material also relates to other application types.
Architectural Building Blocks
In the light of our goals, let's examine the key architectural building blocks of J2EE applications. Later we'll look at how these building blocks can be put together into an entire application architecture. Three core building blocks are:
Business services layer. This is central to successful applications.
Presentation layer. This may be a UI or a remoting facade.
Data access layer. Objects accessing a persistence storeâusually, one or more relational databases.
The Business Services Layer
The key to a sound architecture is a well-defined service layer. This is a layer that exposes business logic to clients such as web or other user interfaces or a remoting layer. It will consist of multiple interfaces, each with a well-defined contract.
In the light of our goals, a well-defined service layer should:
Be complete. It should expose all operations that clients will need. It may need to expose distinct interfaces that support the needs of different clients.
Be simple. Its complexity should be only that warranted by the complexity of business requirements concerned. Its mechanics shouldn't impose great complexity.
Be defined in terms of interfaces, rather than classes, following good OO practice.
Be object oriented. There should be as few constraints as possible ...