Professional Documents
Culture Documents
Modeling Components and Frameworks: Cris Kobryn
Modeling Components and Frameworks: Cris Kobryn
and Frameworks
UML
with
F
or more than a decade ven- Sun Microsystem’s JavaBeans defini-
dors have hyped and under tion has developed into the Enter-
delivered the promises of prise JavaBeans (EJB) specification,
object modeling and com- which supports both transaction and F
ponent technologies. As a persistence services for enterprise
result, object modeling applications [4]. Similarly, Microsoft’s
tools are in disrepute in many devel- COM definition has evolved into the As localized
opment organizations, and the DCOM and COM+ specifications,
semantics of the term “component- and supports the Microsoft Transac- objects evolve
based” have been diluted to an extent tion Server (MTS) for enterprise
reminiscent of what occurred to the applications [3].
into distributed
expression “object-oriented” in the While analyzing the evolution of components,
previous software generation. these technologies it is important to
However, if we put aside our note that strong synergies exist
developers are
skepticism and evaluate recent between them. The coarse granularity asking that UML
advances in these technologies, we of components in relation to classes
find encouraging signs that they are promotes the modularity and reuse provide better
catching up with some of their goals of object modeling. Conversely, support for
hyperbole. Many object modeling the rigorous specification discipline of
tools can now generate production- object modeling supports the inter- component-based
quality skeleton code from structural face-based design and replaceability development
models, and some of them can also aims of components. Consequently, it
derive useful methods from behav- is not surprising that component using EJB and
ioral models. While they still fall far Integrated Development Environ- COM+.
short of the ambitious goals of full ments (IDEs) are converging with
“round-trip engineering,” their visual object modeling tools, a trend
improvements mark significant that is likely to continue.
progress toward automating the soft- This article explores some of the Cris
ware development process. synergies between object modeling
Likewise, the leading component and components by examining how
kobryn
standards have evolved from nascent the de facto object modeling lan-
definitions of simple architectures to guage standard, the Unified Model-
mature specifications of complete ing Language (UML), supports the
runtime environments. For example, leading enterprise component archi-
...
component: A physical,
Component and interface notations showing details
replaceable part of a system that
packages implementation and
Calculate
provides the realization of a set Shorthand
("lollipop") ChangeOrder
of interfaces. A component rep- notation for
ShoppingCart
«EJBRemoteInterface»
terns. In consideration of
ShoppingCartHome «EJBEntityClass» «database»
ShoppingCartimpl
«call»
ShoppingCart
getItemCount()
«call»
this and the scope of this ArtStore
ShoppingCart
setItemCount(...)
getTotal()
setTotal(...)
RemoteObject
article, we will restrict our
...
javax.ejb.EntityContext
modeling of patterns to
«call»
component
modeled as a parameter-
ized collaboration in
Enterprise Component Framework
client Figure 3, where the col- Collaboration
representing the
«COMInterface»
IClassFactory «COMClass»
ShoppingCartimpl
«call»
calls to the PersistenceService in
«database»
ArtStoreDB
IShoppingCart «call»
«call»
getItemCount()
setItemCount(...) ObjectWrapper IShoppingCart
the diagram. We will return to
getTotal()
setTotal(...)
... «call»
this point in the next section,
IObjectContext where we will use it to illustrate
«COMContextObject»
an important difference between
ContextObject the EJB and COM+ architec-
tures.
context
remoteProxy container
factoryProxy
persistenceService
component
Applying the pattern. The
common solution the Enterprise
Component Framework pattern
client Enterprise Component Framework provides for distributed compo-
nent architectures can be
demonstrated by applying it to
model EJB and COM+ exam-
pattern are shown by dashed lines that are labeled ples. We first apply it to an EJB example in Figure 4,
with role names. For example, the roles client, proxy, which shows a ShoppingCart component for an e-
and original from the Proxy pattern shown in the business application modeled as a UML subsystem.
top left of the diagram are bound to the classifier The pattern being applied is shown as a dashed
roles Client, FactoryProxy, and Component in the ellipse in the lower right of the diagram, and the
main pattern. Likewise, the roles client, proxy, and classifiers to which the pattern roles are being
original from the Proxy, pattern shown in the lower applied are shown above the pattern.
left of the diagram are bound to the classifier roles It is noteworthy that the names of several of the
Client, RemoteProxy, and Component in the main classifiers in the collaboration are preceded by UML
pattern. keywords, which are marked by guillemet delimiters
The FactoryProxy and RemoteProxy surrogates (for example, «EJBEntityClass»). The keywords here
perform distinctive roles in the pattern. The former indicate that these classifiers are UML stereotypes
proxy handles object factory operations such as cre- (that is, user-customized extensions to the language)
ate and find, while the latter proxy handles business defined external to the model and not part of stan-
operations specific to the Component (for example, dard UML. These stereotypes highlight areas where
getItemCount, setTotal). The separation of concerns UML needs to be customized to meet the specific
between the proxies is consistent with UML’s classi- needs of particular component architectures, such as
fier-instance dichotomy: the FactoryProxy facilitates EJB or COM+. For example, Java and EJB inter-
class methods, while the RemoteProxy facilitates faces are defined as stereotypes of the UML meta-
instance methods. class Class, since Java and EJB interfaces may declare
The Component and both proxy roles are held in constants, whereas UML standard interfaces cannot.
a component Container, where the containment is The dashed lines between the pattern and the
shown by aggregation relationships (lines with classifiers are labeled with the roles that the classi-
unfilled diamonds at the aggregation end) between fiers play in the collaboration: client, context,
the Container and its contents. The Container rep- remoteProxy, factoryProxy, container, component,
resents the framework’s runtime environment, and persistenceService. These roles are respectively
which supports various distributed processing ser- bound to the following EJB classifiers: ArtStore-
vices, such as interprocess communication, security, Client, «EJBContextObject» ContextObject,
transactions, and persistence. The Container also RemoteObject, HomeObject, ShoppingCart,
includes a Context entity for each Component that «EJBEntityClass» ShoppingCartImpl, and «data-
maintains specific context information, such as the base» ArtStoreDB.
states of transactions, persistence, security, and In the EJB example, the subsystem calls the Art-
deployment. StoreDB directly for persistence services (for exam-
Persistence services for the Component (for ple, database stores and retrievals), indicating that
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.