Modeling Components and Frameworks: Cris Kobryn
Modeling Components and Frameworks: Cris Kobryn
Modeling Components and Frameworks: Cris Kobryn
and Frameworks
UML
with
Sun Microsystems JavaBeans definition has developed into the Enterprise JavaBeans (EJB) specification,
which supports both transaction and
persistence services for enterprise
applications [4]. Similarly, Microsofts
COM definition has evolved into the
DCOM and COM+ specifications,
and supports the Microsoft Transaction Server (MTS) for enterprise
applications [3].
While analyzing the evolution of
these technologies it is important to
note that strong synergies exist
between them. The coarse granularity
of components in relation to classes
promotes the modularity and reuse
goals of object modeling. Conversely,
the rigorous specification discipline of
object modeling supports the interface-based design and replaceability
aims of components. Consequently, it
is not surprising that component
Integrated Development Environments (IDEs) are converging with
visual object modeling tools, a trend
that is likely to continue.
This article explores some of the
synergies between object modeling
and components by examining how
the de facto object modeling language standard, the Unified Modeling Language (UML), supports the
leading enterprise component archi-
As localized
objects evolve
into distributed
components,
developers are
asking that UML
provide better
support for
component-based
development
using EJB and
COM+.
Cris
kobryn
31
ShoppingCart
+calcWeight()
+calcShipping()
+calcTotal()
...
interface
Calculate
interface
ChangeOrder
+addItem(item:Item)
+deleteItem()
+saveItem()
...
Component
showing
attributes and
operations
+Weight
+Shipping
...
+orderItems
...
+calcWeight()
+calcShipping()
...
+addItem(item:OrderItem)
+deleteItem()
...
Calculate
Shorthand
("lollipop")
notation for
interface
ChangeOrder
ShoppingCart
A computational
node, in this case
an application
server
Indicates
replication
32
Is a classifier?
Can have operations?
Can have methods?
Can have attributes?
Can have interfaces?
Can be associated?
Can have thread of
control?
Can be nested?
Is a grouping construct?
Can import/access?
Represents a unit in a
physical system?
Contains implementation
of model elements?
Can create instances?
Instances typically reside
on nodes?
SUBSYSTEM
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (optional)
an online stockbroker system, where several components deployed on an instance of the primary application server node (primaryServer) are replicated on
the backup application server node (backupServer).
On the primaryServer the primaryBroker, an instance
of the component StockBroker, calls the interfaces of
the primaryQuoter (an instance of the QuoteService
component) and the primaryDB (an instance of the
AccountsDB component). Component replication
and migration are shown by copy and become
dependency flows, which are part of standard UML.
CLASS
+
+
+
+
+
+
+
33
both the Java and EJB specifiTable 2. Usage heuristics for components, subsystem, and classes.
cations emphasize interfacebased design.
COMPONENT
SUBSYSTEM
CLASS
When choosing among these
Tend to be coarse+
+
+
+
some usage heuristics. Although
during analysis?
the UML is a modeling lanTypically modeled
+
+
guage and not a software
during design?
method, the specification does
Typical modeled
+
+
provide some usage notes
during implementation?
regarding how some constructs
can be used during various
phases in the software life cycle.
Figure 3. Enterprise component framework pattern.
Other heuristics may be gleaned
from component methods, specifications, and applications.
With the caveat that these are
Proxy
basic guidelines and not rules,
Enterprise Component Framework
Table 2 summarizes some
heuristics for applying the classifiers in question.
In general, components and
subsystems tend to be more
coarse-grained than classes.
Indeed, it is common for a component to implement multiple
design classes. Similarly, it is
typical for a subsystem to model
the specification and realization
of a set of model elements,
which may include both specifiProxy
cation types and implementation classes. Components are
further distinguished from both subsystems and emphasizes the reuse of design patterns and archiclasses in that they are typically modeled during the tectures. One common definition is that a frameimplementation phase (compare analysis and design work is a reusable design of all or part of a system
phases). It is important to note, however, that the represented by a set of abstract classes and the way
classes and/or subsystems specifying components their instances interact. Another frequently used
and frameworks may be modeled during an earlier definition is that a framework is the skeleton of an
application that can be customized by an applicalife-cycle phase, such as analysis or design.
tion developer [5]. These definitions are compleModeling Component Frameworks
mentary, not conflicting, since the former describes
Components are quintessential software building a framework from a design perspective, whereas the
blocks that can be recursively composed to build sys- latter describes it from a functional viewpoint.
tems of increasing size and complexity. Just as the However, the differences between the two definihardware industry has used integrated circuits to tions point out the variety of ways in which the
recursively build larger and more complex hardware term is used.
components, the software industry now endeavors
Although the UML definition of a framework is
to do something similar with software components. more restrictive than the preceding definitions, it is
Component frameworks are important mechanisms compatible with them:
being used to accomplish this.
A framework is a generic term for a powerful framework: 1) A stereotyped package consisting
object-oriented reuse technique that typically mostly of patterns. 2) An architectural pattern that
The Proxy pattern used here is defined
in [1]. Note that the pattern is used
twice.
original
proxy
client
Factory
call
FactoryProxy
Client
call
call
Factory
original
Component
call
Remote
Remote
RemoteProxy
call
Context
PersistenceService
Container
proxy
client
34
call
{xor}
Persistence
Service
Indicates a
Subsystem
EJBHomeInterface
ShoppingCartHome
call
ArtStoreClient
HomeObject
create(...)
findByPrimaryKey(...)
...
call
ShoppingCartHome
EJBRemoteInterface
ShoppingCart
call
call
getItemCount()
setItemCount(...)
getTotal()
setTotal(...)
...
EJBEntityClass
ShoppingCartimpl
database
ArtStore
ShoppingCart
RemoteObject
call
javax.ejb.EntityContext
EJBContextObject
ContextObject
remoteProxy
context
client
container
factoryProxy
persistenceService
component
Collaboration
representing the
pattern structure
35
RealizationElements
COMInterface
IClassFactory
call
ArtStoreClient
call
call
FactoryWrapper
createinstance(...)
lockServer(...)
...
IClassFactory
COMInterface
IShoppingCart
call
getItemCount()
setItemCount(...)
getTotal()
setTotal(...)
...
COMClass
ShoppingCartimpl
IShoppingCart
ObjectWrapper
call
IObjectContext
COMContextObject
ContextObject
remoteProxy
context
client
persistenceService
container
component
factoryProxy
call
database
ArtStoreDB
37
References
1. Buschmann, F., et al. Pattern-Oriented Software Architecture: A System of
Patterns. Wiley, NY, 1996.
2. DSouza, D. and Wills, A.C. Objects, Components and Frameworks with
UML: The Catalysis Approach. Addison-Wesley, Reading, MA, 1999.
3. Eddon, G. and Eddon, H. Inside COM+ Base Services. Microsoft Press,
1999.
4. Enterprise Java Beans Specification, v. 2.0. Public draft, Sun Microsystems, May 2000.
5. Fayad, M., et al. Building Application Frameworks. Wiley, NY, 1999.
6. Gamma, E., et al. Design Patterns: Elements of Reusable Object-Oriented
Software. Addison-Wesley, Reading, MA, 1995.
7. Jacobson, I., et al. The Unified Software Development Process. AddisonWesley, Reading, MA, 1999.
8. UML/EJB Mapping Specification, Java Specification Request ID#
000026, Java Community Process, Sun Microsystems, July 1999.
9. UML Revision Task Force, OMG Unified Modeling Language Specification, v. 1.3, document ad/99-06-08. Object Management Group,
June 1999.
WEB REFERENCES
www.celigent.com/omg/umlrtf is the OMG UML Revision Task Force home page. Contains UML
specification artifacts, including the latest UML specification and drafts of works-in-progress. Also
includes a link to the UML 2.0 Working Group page.
java.sun.com/products/ejb/ is the Enterprise JavaBeans home page. Contains links to diverse
resources related to EJB, including specifications, white papers, and tutorials.
java.sun.com/aboutJava/communityprocess/ is the Java Community Process home page. Contains
information about the JCP process, specification proposals, calls for experts, and specification drafts.
www.microsoft.com/com/tech/complus.asp is the COM+ home page. Contains links to a wide range
of resources related to COM+, including white papers, presentations, and books.
38