Java Reference
In-Depth Information
10 Encapsulates.Sigh.Can'twejustsay“wraps”?WhydoeseverytermfromOOPhavetobesooverlycomplicated?
Why can't we just “make” or “create” something, rather than “instantiate” it? And I get the whole “many forms”
idea, but who thought the term “polymorphism” was exactly what we needed? Who talks like that (other than me,
after all these years)?
While I'm on the subject, I need to show you one more figure that's inevitable in the web
application world. It's the standard Model-View-Controller (MVC) architecture, illustrated
in figure 10.6 .
Figure 10.6. The Model-View-Controller (MVC) architecture, little changed since the days of Smalltalk. Views
display model objects, which are created and configured by controllers.
The basic idea behind MVC is separation of concerns. Views display model objects, collect
data from users, and submit it to controllers. Controllers create and configure model ob-
jects and forward them to the views. While the controllers and views are tightly coupled,
the model objects are not tied to either. If anything in the system is reusable, it's the model
classes. By the way, noticeably absent from this architecture are the services from the pre-
vious figure, but the approach is an oversimplification anyway, so I choose not to worry
about it.
Grails is typical of the MVC-based, layered architecture just described, with some interest-
ing variations that are discussed in this section. Grails is notable for several reasons:
• Grails is built on top of existing, mature technologies . Grails combines a series of
Groovy domain-specific languages (DSLs) on top of Spring and Hibernate.
 
 
Search WWH ::




Custom Search