Patterns, Frameworks, and Middleware: Their Synergistic Relationships
Patterns, Frameworks, and Middleware: Their Synergistic Relationships
Abstract time and within budget remains hard. Some problems stem
from the growing demands placed on software, such as re-
The knowledge required to develop complex software has his- quirements to provide predictable, reliable, scalable, and se-
torically existed in programming folklore, the heads of experi- cure quality of service (QoS) simultaneously. Other problems
enced developers, or buried deep in the code. These locations stem from the propensity to rediscover and reinvent core soft-
are not ideal since the effort required to capture and evolve ware artifacts, such as programming languages, operating sys-
this knowledge is expensive, time-consuming, and error-prone. tems, networking protocols, and software component libraries.
Many popular software modeling methods and tools address Moreover, the heterogeneity of hardware architectures, diver-
certain aspects of these problems by documenting how a sys- sity of operating system (OS) and network platforms, and stiff
tem is designed. However, they only support limited portions global competition makes it increasingly infeasible to build
of software development and do not articulate why a system high-quality software from scratch.
is designed in a particular way, which complicates subsequent
software reuse and evolution. In today’s time-to-market-driven environments, building
Patterns, frameworks, and middleware are increasingly quality software in cost-effective manner requires the system-
popular techniques for addressing key aspects of the chal- atic reuse of successful software models, designs, and imple-
lenges outlined above. Patterns codify reusable design ex- mentations that have already been developed and tested. Un-
pertise that provides time-proven solutions to commonly oc- like opportunistic reuse (in which developers simply cut and
curring software problems that arise in particular contexts paste code from existing programs to create new ones), sys-
and domains. Frameworks provide both a reusable product- tematic reuse is an intentional and concerted effort to create
line architecture [1] – guided by patterns – for a family of and apply multiuse software artifacts throughout an organi-
related applications and an integrated set of collaborating zation. In a well-honed systematic reuse process, each new
components that implement concrete realizations of the ar- project leverages time-proven designs and implementations,
chitecture. Middleware is reusable software that leverages mostly just adding new code that is specific to a particular ap-
patterns and frameworks to bridge the gap between the func- plication, and only refactoring existing software architectures
tional requirements of applications and the underlying oper- and designs when they become inadequate to cover the evolv-
ating systems, network protocol stacks, and databases. This ing business cases and variability in the supported domains.
paper presents an overview of patterns, frameworks, and mid- Systematic reuse is essential to increase software productiv-
dleware, describes how these technologies complement each ity and quality by breaking the costly cycle of rediscover-
other to enhance reuse and productivity, and then illustrates ing, reinventing, and revalidating common software artifacts.
how they have been applied successfully in practice to improve Throughout the rest of the paper when we use the term “reuse”
the reusability and quality of complex software systems. we therefore always mean “systematic reuse.”
The skills required to develop, deploy, and support reusable
software have traditionally been a “black art” practiced only
1 Introduction by expert developers and architects. Moreover, these techni-
cal impediments to reuse are often exacerbated by a myriad of
Emerging trends and challenges. Despite significant ad-
nontechnical impediments, such as organizational, economic,
vances in computers, networks, programming languages, and
administrative, political, sociological, and psychological fac-
software methodologies, developing quality applications on
tors. It’s therefore not surprising that significant levels of soft-
This work was supported in part by DARPA, NSF, and Siemens. ware reuse have been slow to materialize in many projects and
organizations. and patterns support the development of product-line archi-
tectures for specific application domains, such as warehouse
Solution approach ! Middleware, framework, and pat- management or hot rolling mill process automation [14], that
terns. Middleware [2] is software that can significantly in- apply particular types of middleware. A contribution of this
crease reuse by providing readily usable, standard solutions paper is to illustrate by examples how these three technologies
to common programming tasks, such as persistent storage, relate and complement each other.
(de)marshaling, message buffering and queueing, request de- Paper organization. The remainder of this paper is orga-
multiplexing, and concurrency control. Developers who use nized as follows: Section 2 presents an taxonomy of the layers
middleware can therefore focus primarily on application- of middleware; Sections 3 and 4 describe the key properties
oriented topics, such as business logic, rather than wrestling of frameworks and patterns, respectively; Section 5 then illus-
with tedious and error-prone details associated with program- trates the synergies between all three technologies via a case
ming infrastructure software using lower-level OS APIs and study of how frameworks and patterns have been applied in
mechanisms. practice to develop middleware for distributed real-time and
Over the past decade a number of middleware standards embedded systems; Section 6 summarizes promising areas of
have emerged and matured. Some of these standards, such as future R&D; and Section 7 presents concluding remarks.
the Common Object Request Broker Architecture (CORBA),
are open systems sanctioned by international organizations,
such as the Object Management Group (OMG). Other middle- 2 An Overview of Middleware
ware standards, such as Java virtual machines, Jave 2 Enter-
prise Edition (J2EE), and .NET, have emerged from industry Some of the most successful techniques and tools devised to
consortia and market leaders. enhance the reuse of software center on middleware that helps
Crucial to the success of standard middleware are the pat- manage the complexity and heterogeneity of distributed appli-
terns [3, 4, 5] and frameworks [6, 7] that reify the knowledge cations. This distributed computing middleware (henceforth
of how to develop and apply the middleware and applications referred to simply as middleware) provides reusable software
that run atop it. Patterns support the reuse of design expertise that functionally bridges the gap between (1) end-to-end ap-
by articulating the static and dynamic aspects of successful plication functional requirements and (2) the lower-level op-
solutions to problems that arise when building software in a erating systems, networking protocol stacks, databases, and
particular context. Frameworks are concrete realizations of hardware devices. Middleware provides reusable capabilities
groups of patterns that enable reuse of code by (1) captur- whose qualities are critical to help simplify and coordinate
ing the common abstractions of an application domain – both how application software is connected and how it interoper-
their structure and mechanisms – while (2) yielding control of ates.
application-specific structure and behavior to application de- Just as networking protocol stacks can be decomposed into
velopers. multiple layers, such as the physical, data-link, network, trans-
During the past decade a number of influential R&D ef- port, session, presentation, and application layers, so to can
forts [4, 8, 5, 9, 10, 11, 12, 13] have focused on documenting middleware be decomposed into the multiple layers [2] shown
patterns and developing frameworks that enable the effective in Figure 1 and described in the remainder of this section.
development and reuse of middleware. As a result, middle- Host infrastructure middleware encapsulates and enhances
ware is now commonly developed using frameworks based on native OS mechanisms to create reusable event demultiplex-
strategized composition and optimization patterns. These pat- ing, interprocess communication, concurrency, and synchro-
terns and frameworks guide the integration and configuration nization objects, such as reactors; acceptors, connectors, and
of middleware that can meet the functional and QoS require- service handlers; monitor objects; active objects; and service
ments of particular application domains more effectively than configurators [9, 10]. By encapsulating the peculiarities of
can realistically be developed manually from scratch in time- particular operating systems, these reusable objects help elim-
to-market driven environments. inate many tedious, error-prone, and non-portable aspects of
The relationship between middleware, frameworks, and pat- developing and maintaining application software via low-level
terns is highly synergistic. For example, patterns help guide OS programming APIs, such as Sockets or POSIX pthreads.
framework design and use, thereby reducing software devel- Common host infrastructure middleware includes the Sun
opment effort and training costs. In turn, frameworks can be Java Virtual Machine (JVM) and Microsoft’s Common Lan-
used to develop middleware for product-line architectures [1], guage Runtime (CLR), which provide platform-independent
whose interfaces then provide application software with a sim- ways of executing code by abstracting the differences be-
pler facade to access the powerful (and complex) internal com- tween operating systems and CPU architectures. The ADAP-
ponent structure of the frameworks. Likewise, frameworks TIVE Communication Environment (ACE) [9, 10] is portable
middleware service providers bundle transactional behavior,
APPLICATIONS
security, and database connection pooling and threading into
reusable components, so that application developers no longer
DOMAIN-SPECIFIC HUD AVIONICS need to write code that handles these tasks.
MIDDLEWARE WTS REPLICATION
SERVICES Nav SERVICE Whereas distribution middleware focuses largely on manag-
ing end-system resources in support of an object-oriented dis-
COMMON Cons
EVENT Cons tributed programming model, common middleware services
MIDDLEWARE CHANNEL
SERVICES Cons focus on allocating, scheduling, and coordinating various re-
sources throughout a distributed system using a component
DISTRIBUTION programming and scripting model. Developers can reuse these
MIDDLEWARE component services to manage global resources and perform
common distribution tasks that would otherwise be imple-
HOST
INFRASTRUCTURE mented in an ad hoc manner within each application. The form
MIDDLEWARE and content of these services will continue to evolve as the re-
quirements on the applications being constructed expand.
OPERATING Examples of common middleware services include the
SYSTEMS
OMG’s CORBA Common Object Services, such as event no-
HARDWARE tification, logging, multimedia streaming, persistence, secu-
DEVICES rity, global time, real-time scheduling, fault tolerance, con-
currency control, and transactions. Likewise, Sun’s Enterprise
Figure 1: Middleware Layers in Context
Java Beans (EJB) technology and Microsoft’s .NET allows de-
velopers to create n-tier distributed systems by linking a num-
C++ host infrastructure middleware that encapsulates na- ber of pre-built software service components without having
tive operating system capabilities, such as connection estab- to write much code manually.
lishment, event demultiplexing, interprocess communication, Domain-specific middleware services are tailored to the
(de)marshaling, dynamic configuration of application compo- requirements of particular domains, such as telecom, e-
nents, concurrency, and synchronization. commerce, health care, process automation, or aerospace. Un-
like the other three middleware layers discussed above that
Distribution middleware defines higher-level distributed pro-
provide broadly reusable “horizontal” mechanisms and ser-
gramming models whose reusable APIs and objects automate
vices, domain-specific middleware services are targeted at
and extend the native OS mechanisms encapsulated by host
“vertical” markets and product-line architectures. Since they
infrastructure middleware. Distribution middleware enables
embody knowledge of a domain, moreover, reusable domain-
clients to program applications by invoking operations on tar-
specific middleware services have the most potential to in-
get objects without hard-coding dependencies on their loca-
crease the quality and decrease the cycle-time and effort re-
tion, programming language, OS platform, communication
quired to develop particular types of application software.
protocols and interconnects, and hardware.
An example of domain-specific middleware services in-
At the heart of distribution middleware are request bro- cludes the Siemens Medical Solutions Group has developed
kers, such as The OMG’s Common Object Request Broker syngo (www.syngo.com), which is a product-line archi-
Architecture (CORBA) and Sun’s Java Remote Method Invo- tecture that is both an integrated collection of domain-specific
cation (RMI). The request brokers allow objects to interoper- middleware services, as well as an open and dynamically ex-
ate across networks regardless of the platform on which they tensible application server platform for medical imaging tasks
are deployed. SOAP is an emerging distribution middleware and applications, including ultrasound, mammography, an-
technology based on an XML-based protocol that allows ap- giography, computer tomography, magnetic resonance, and
plications to exchange structured and typed information on the nuclear medicine. The Boeing Bold Stroke [15, 16] product-
Web using various Internet protocols, such as HTTP, SMTP, line architecture is another example of domain-specific mid-
and MIME. dleware. Bold Stroke uses COTS hardware and middleware
Common middleware services augment distribution middle- to produce a non-proprietary, standards-based component ar-
ware by defining higher-level domain-independent reusable chitecture for military avionics mission computing capabili-
services that allow application developers to concentrate on ties, such as navigation, display management, sensor manage-
programming business logic, without the need to write the ment and situational awareness, data link management, and
“plumbing” code required to develop distributed applications weapons control.
via lower-level middleware directly. For example, common As the products associated with the reusable middleware
layers summarized above have matured and become perva- EVENT
NETWORKING
sive throughout the industry, the total amount of software that LOOP
If the insights and rationale of experienced designers are please see the references [5] for comprehensive coverage of these patterns.
Thread-per Active resolving a given problem, how are mutual dependencies be-
Acceptor
Request Object tween the problems handled, and how is each individual prob-
lem resolved effectively in the presence of its associated prob-
Thread-per
Session Connector lems.
Half-Sync/ Many pattern languages exist today. Some support the cre-
Thread Half-Async Component ation of a specific types of software, such as the pattern lan-
Pool Configurator guages for networked and concurrent computing [5] and enter-
prise application architectures [13]. Others pattern languages
Thread Leader/ Object help to realize a certain part, subsystem, or large component
Specific Followers Lifetime of a software system. For instance, there is a pattern language
Storage Manager for server components [12] that describes how to build well-
structured server-side components. Yet other languages focus
Asynchronous Reactor
Completion Double Thread- on a particular problem area of relevance in software, such as
Token Checked Safe handling erroneous user input [24] and designing user-friendly
Proactor Locking Interface interfaces to computer and information systems [25]. There
are also pattern languages for good programming style and
External Wrapper Scoped Strategized practice, such as Smalltalk best practice patterns [26], C++
Polymorphism Facade Locking Locking reference accounting [27], and Java exception handling [28].
Section 6 describes other key areas where we expect future
pattern languages will be published.
Concurrency Event Initialization Synchronization
Patterns Patterns Patterns Patterns
5 Illustrating the Synergies of Middle-
Figure 3: A Pattern Language for Network Programming
ware, Frameworks, and Patterns
service access, concurrency models, and synchronization Sections 2–4 present overviews of middleware, frameworks,
strategies. Each problem in these areas must be resolved and patterns, emphasizing their particular contributions to
coherently and consistently when developing concurrent software reuse. This section examines these technologies in
and networked applications. terms of their relationships and synergies. To make the dis-
The pattern language also exposes the interdependencies cussion tangible, we focus on The ACE ORB (TAO) [29] as a
of these technical areas. For example, when selecting a case study to illustrate how patterns and frameworks can help
particular event-handling pattern for a networked appli- middleware developers build and evolve software by reducing
cation, not all potentially-available concurrency patterns the coupling between its components.
can be applied usefully.
A pattern language describes an entire solution space for 5.1 Overview of CORBA and TAO
developing a particular type of system, system part, or
system aspect – by offering alternative solutions to cer- CORBA Object Request Brokers (ORBs) [30] allow clients to
tain problems. A pattern language can therefore be ap- invoke operations on distributed objects without concern for
plied many, many times without ever producing exactly object location, programming language, OS platform, commu-
the same architecture, design, or implementation. Yet nication protocols and interconnects, and hardware. Figure 4
each individual architecture, design, and implementation illustrates the components in the CORBA reference model,
follows the same timeless, thus reusable, design knowl- which collaborate to provide the portability, interoperability,
edge embedded in each pattern language [23]. and transparency mentioned above. The client stubs marshal
client operations into General Inter-ORB Protocol (GIOP) re-
These three points become clear only when connecting pat- quests that are transmitted to objects via the standard Internet
terns into a pattern language since each pattern in isolation
Inter-ORB Protocol (IIOP)3 implemented in the ORB Core.
only focuses on itself. In contrast, a pattern language-based The server ORB Core demultiplexes and receives these re-
design integrates the patterns consistently and synergistically quests using one or more threads and passes them to the Ob-
by giving concrete and precise guidance in developing a spe-
ject Adapter. The Object Adapter demultiplexes the requests
cific (type of) system or system aspect. In particular, a pattern to skeletons, which demarshal the requests and dispatch the
language conveys what are the key problems to be resolved, in
what order should they be tackled, what alternatives exist for 3 IIOP is implemented atop TCP/IP.
in args CLIENT OBJECT/SERVANT
operation() OBJECT
CLIENT OBJ
(SERVANT)
REF out args + return STUB ADAPTER SKEL
value
PROXY MANAGER
IDL
SKELETON
DSI
DII IDL ORB OBJECT <<CREATES HANDLERS>>
ORB CORE <<CREATES HANDLERS>>
STUBS
INTERFACE ADAPTER
LEADER/
CONNECTOR FOLLOWERS
ORB CORE GIOP/IIOP/ESIOPS ACCEPTOR