Figure 1.2. The component services offered by EJB 3 at the supported application layer. Note that each service is
independent of the others, so you are (for the most part) free to pick the features important for your application.
In a typical Java EE-based system, JSF and CDI will be used at the presentation tier, EJB
will be used in the business layer, and JPA and CDI will be used in the persistence tier.
The traditional four-tier layered architecture isn't perfect. One of the most common criti-
cisms is that it undermines the OO ideal of modeling the business domain as objects that
encapsulate both data and behavior. Because the traditional architecture focuses on model-
ing business processes instead of the domain, the business logic tier tends to look more like
a database-driven procedural application than an OO one. Because persistence-tier com-
ponents are simple data holders, they look a lot like database record definitions rather than
first-class citizens of the OO world. As you'll see in the next section, DDD proposes an
alternative architecture that attempts to solve these perceived problems.
Figure 1.3 shows domain-driven architecture. The term domain-driven design may be rel-
atively new but the concept is not (see Domain-Driven Design: Tackling Complexity in the