Java Reference
In-Depth Information
Programming languages and techniques evolve as developers discover new and
better ways to build applications. In the 1990s, it was generally accepted that a
good way to tackle the complexity of applications was to use object-oriented ( OO )
design techniques. Then, the end of that decade saw the arrival of Enterprise Java-
Beans ( EJB s). Before using EJB s, I spent over a decade developing applications in
a variety of OO languages, including Common Lisp, C++, and Java. But OO design
became a lot less important and a lot more difficult when doing EJB development.
Even though many early enterprise Java applications were quite complex and
could have benefited from using an OO approach, there were, as I described in
chapter 1, cultural and technical obstacles to using such a strategy. Fortunately,
Java technologies have evolved to sweep those obstacles aside. By developing with
POJO s and lightweight frameworks, you can use OO design techniques in your
enterprise Java applications.
This chapter describes the Domain Model pattern, which organizes the busi-
ness logic as a domain model. A domain model is an object model of the applica-
tion's problem domain, which identifies the problems that the application is
trying to solve. The Domain Model pattern is important because it offers all of
the benefits of object-oriented development, including improved maintainability
and extensibility.
In this chapter, you will learn how a domain model fits into the application's
architecture and its relationship with the presentation tier and the persistence
framework. I also describe the structure of the domain model and show how to
decouple it from the database and other external components so that it can be
developed and tested more easily. You will learn how to develop a POJO domain
model using test-driven development techniques. Throughout this chapter I use
the domain model for the Place Order use case as an example.
3.1 Understanding the Domain Model pattern
The Domain Model pattern implements the business logic using good old-
fashioned object-oriented analysis and design techniques ( OOAD ). This pattern
uses OOAD to build an object model—the domain model—that is both a descrip-
tion of the problem domain and a blueprint for the design of the business logic.
An object model consists of classes corresponding to concepts from the problem
domain, which can make it easier to understand. Moreover, as I have mentioned
previously, an object model is an excellent way to tackle complex business logic.
Business logic that is implemented using the Domain Model pattern is struc-
tured very differently than the traditional EJB design. Rather than the business
 
 
 
 
 
Search WWH ::




Custom Search