component-based presentation layer architecture that
can lead to direct coupling: events shared between
components, event data shared between components,
and containment relationships between components.
The following sections describe the AMVC
architecture, which removes each of these causes of
coupling between components.
1.1 The AMVC Component
Abstraction
The first step in defining a component-based
architecture is to define the abstraction of the
component itself. The AMVC architecture’s notion
of a component is heavily influenced by the hMVC
iii
(hierarchical Model View Controller) design (and
therefore on PAC of which it is a specialized case
iv
),
even to the extent of using the same terminology.
But the AMVC component abstraction diverges
from hMVC in a number of ways. AMVC can be
said to be a modification and an extension of hMVC
since the AMVC architecture also incorporates an
extra layer of indirection that hMVC does not
possess. A summary of the precise nature of the
differences between the two architectures is
provided towards the end of this paper, after a fuller
explanation of AMVC has been offered.
An AMVC component is a Model-View-
Controller grouping (Triad) where the controller has
a function beyond the coordination of events
between the model and the view: It also directs
events out of the triad to other triads. Components
are organized into a hierarchy as in hMVC and
controllers act as the point of contact between the
triads. Each component has its own individual
functionality, but in the context of the AMVC
architecture, the component is abstracted as a Triad
that, from an external perspective, is simply capable
of receiving events, emitting events, and entering
into a parent-child relationship with another triad.
Another public aspect of a Triad is the view itself -
this will be described later. We now consider the
way these components are organized into
applications.
1.2 Two Layers – Two Activities
We can identify two separate layers in the
construction of a rich client using AMVC. The
component layer is composed of independent and
functionally specialized Triads. The model elements
of these Triads typically communicate with
particular services in an SOA
v
, if they have any
server-side functionality at all. The application layer
consists of application-specific configuration
information that links instances from the component
layer - without introducing coupling between these
components. It is this absence of coupling that
defines the AMVC architecture and represents its
main value proposition.
The work of developing a rich client application
can be broken up into two activities that correspond
to the two layers above: component development
and application assembly. In the absence of direct
coupling between the components, applications can
be assembled by combining and re-combining
components in different ways, re-using the same
component types many times within one application,
and achieving different results with each
combination.
To appreciate how this architecture provides for
decoupling between components, it is important to
understand the factors that lead to coupling in the
first place. But in order to do that, we must first look
at the different kinds of events defined by AMVC.
1.2.1 AMVC Event Types
There are two kinds of events defined by AMVC:
Component Events and Application Events,
corresponding to the Application and Component
layers. Within AMVC components, the Model and
View elements typically communicate with each
other by means of Component Events
(implementations allow for views directly calling
model for efficiency and simplicity– though not
vice-versa). Some of these events are exposed
outside the components as emitted events, or
received events, or both.
Note that Component Events should be
distinguished from what we will here call widget
events. The latter are well understood concepts of
GUI programming and communicate low-level
interface-specific events (e.g. 'button A has been
pushed') to components. The component layer
intercepts, interprets and combines these widget
events into Component Events, which represent
reusable business functionality for a specific service
(e.g. 'List the Orders'). Application Events are
described below.
1.2.2 Coupling Due to Event Sharing
Event-passing is a common way for components to
communicate. Although this can often be done in
such a way that avoids the programmatic coupling of
the communicating components, a form of coupling
remains: the name of the event itself. If an event is
passed from one component to another, the
communicating components must have a shared
understanding of what that event means. This
ICSOFT 2007 - International Conference on Software and Data Technologies
352