Selic Pragmatics

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

focus

model-driven development

The Pragmatics of
Model-Driven Development
Bran Selic, IBM Rational Software

sing models to design complex systems is de rigeur in traditional

U engineering disciplines. No one would imagine constructing an


edifice as complex as a bridge or an automobile without first con-
structing a variety of specialized system models. Models help us
understand a complex problem and its potential solutions through abstrac-
tion. Therefore, it seems obvious that software systems, which are often
among the most complex engineering systems, can benefit greatly

from using models and modeling techniques. with all new technologies, MDD’s success re-
However, for historical reasons, models in lies on carefully introducing it into the existing
software engineering are infrequent and, even technological and social mix. To that end, I
when used, they often play a secondary role. cite several pragmatic criteria—all drawn
Yet, as we shall see, the potential benefits of from industrial experience with MDD.
using models are significantly greater in soft-
ware than in any other engineering discipline. The challenge
Model-driven development methods were Software engineering is in the unfortunate
devised to take advantage of this opportunity, position of being a new and relatively imma-
and the accompanying technologies have ma- ture branch of engineering of which much is
tured to the point where they are generally expected. Seduced by the relative ease of writ-
useful. A key characteristic of these methods ing code—there is no metal to bend or heavy
is their fundamental reliance on automation material to move—and compelled by relentless
and the benefits that it brings. However, as market pressures, software users and develop-
ers are demanding systems whose complexities
often exceed our abilities to construct them.
This situation is not without precedent in
Model-driven development holds promise of being the first true the history of technology; similar situations
generational leap in software development since the introduction of occurred when the Industrial Revolution in-
the compiler. The key lies in resolving pragmatic issues related to the troduced new technologies such as steam and
artifacts and culture of previous generations of software technologies. electrical power.1 What seems to be unique,

Published by the IEEE Computer Society IEEE SOFTWARE 19


however, is how slowly software technologies cal to any engineering endeavor’s success, it’s
have evolved to meet the obvious need for im- too soon to discount the possibilities that new
Many proving product reliability and productivity. programming technologies can achieve. After
In particular, since the introduction of third- all, software development consists primarily of
practitioners generation languages in the late 1950s, the expressing ideas, which means that our ability
have given up essence of programming technology has hardly to devise suitable facilities is mostly limited by
changed. Although we’ve introduced several our imagination rather than by unyielding phys-
all hope that new programming paradigms since then—such ical laws. Taking advantage of this opportunity
significant as structured and object-oriented program- is one of the central ideas behind MDD and one
progress will ming—and much work has been done to polish
the details, the level of abstraction of market-
of the reasons why it represents the first true
generational shift in basic programming tech-
result from dominant programming languages has re- nology since the introduction of compilers.
fundamental mained almost constant. An If or Loop state- I recognize that similar software “revolu-
ment in a modern programming language such tions” have been proclaimed many times in
advances in as Java or C++ is not that much more potent the past but have had little or no fundamental
programming than an If or Loop statement in early Fortran. impact in the end. Is there any reason to ex-
technologies. Even promising mechanisms such as classes and
inheritance, which have potential for producing
pect otherwise in this case? After all, MDD is
based on the old idea of modeling software—
higher forms of abstraction, remain underused. a technique that has produced more than its
Objects, for example, are relegated to relatively share of skeptics.
fine-grained abstractions confined to a single
address space (such as stacks, data structures, The essentials
or graphic primitives) consistent with the gran- MDD’s defining characteristic is that soft-
ularity and abstraction level of the languages in ware development’s primary focus and prod-
which they appear. ucts are models rather than computer pro-
In an industry that prides itself on its rapid grams. The major advantage of this is that we
advances, this apparent reluctance to move express models using concepts that are much
forward despite an obvious need might seem less bound to the underlying implementation
surprising. However, consider the sheer scale technology and are much closer to the problem
of investment—fiscal and intellectual—in domain relative to most popular programming
those early-generation technologies. There are languages. This makes the models easier to
countless lines of code written in traditional specify, understand, and maintain; in some
programming languages that programmers cases, it might even be possible for domain ex-
must maintain and upgrade. This, in turn, cre- perts rather than computing technology special-
ates a continuous demand for professionals ists to produce systems. It also makes models
who are trained in and culturally attuned to less sensitive to the chosen computing technol-
these technologies. Because of their intricate ogy and to evolutionary changes to that tech-
nature, attaining competency in such pro- nology (the concept of platform-independent
gramming technologies requires significant in- models is often closely connected to MDD).
vestments in time and effort. This, quite un- Of course, if models end up merely as docu-
derstandably, fosters a conservative mindset in mentation, they are of limited value, because
both individuals and corporations. Unless we documentation all too easily diverges from re-
properly account for such factors, no technical ality. Consequently, a key premise behind MDD
breakthrough is likely to succeed, regardless of is that programs are automatically generated
how advanced and promising it might be. from their corresponding models.
Many practitioners have given up all hope As noted, however, both software modeling
that significant progress will result from fun- and automatic code generation have been tried
damental advances in programming technolo- before, meeting with limited success at best
gies; instead, they are placing their hopes on and mostly in highly specialized domains. But
process improvements. This partly explains things have progressed since the early days.
the current surge of interest in methods such Aside from the fact that we now better under-
as Extreme Programming and the Rational stand how to model software, MDD is more
Unified Process.2 useful today because of two key evolutionary
Although following a proper process is criti- developments: the necessary automation tech-

20 IEEE SOFTWARE h t t p : / / c o m p u t e r. o r g / s o f t w a r e
nologies have matured and industry-wide the development cycle, because this is when
standards have emerged. software designers make most of the funda-

Automation technologies
mental design decisions. Despite all the
The techniques and tools for doing this suc-
Automation is by far the most effective cessfully have now reached a degree of matu- benefits of
technological means for boosting productivity rity where this is practical even in large-scale automation and
and reliability. However, most earlier attempts industrial applications. Modern code genera-
at applying automation to software modeling tors and related technologies can produce
standardization,
were limited to “power-assist” roles, such as code whose efficiency is comparable to (and model-driven
diagramming support and skeletal code gener-
ation. These are often not substantive enough
sometimes better than) hand-crafted code.
Even more importantly, we can seamlessly in-
methods are
to make a significant difference to productivity. tegrate such code generators into existing soft- only as good as
For example, once the code is generated, the ware production environments and processes. the models they
models are abandoned because, like all soft- This is critical because it minimizes the dis-
ware documentation, they require scarce and ruption that occurs when MDD is deployed.
help us
expensive resources to maintain. This is why construct.
solutions based on so-called round-trip engi- Standards
neering, which automatically converts code The last decade has seen the emergence of
back into model form, are much more useful. widely supported industry standards, such as
One drawback here, though, is that an auto- those that the Object Management Group
mated conversion from code to model usually provides. The OMG is a consortium of soft-
can’t perform the kind of abstraction that a ware vendors and users from industry, govern-
human can. Therefore, we can attain MDD’s ment, and academia. It recently announced its
full benefits only when we fully exploit its po- Model-Driven Architecture initiative, which
tential for automation. This includes offers a conceptual framework for defining a
set of standards in support of MDD (see
■ Automatically generating complete pro- www.omg.org/mda/index.htm). A key MDA
grams from models (as opposed to just standard is the Unified Modeling Language,
code skeletons and fragments) along with several other technologies related
■ Automatically verifying models on a com- to modeling.3–5 In addition, other formal and
puter (for example, by executing them) de facto standards, such as various Web stan-
dards (XML, SOAP, and so forth) are also ma-
Complete code generation simply means jor enablers of MDD.
that modeling languages take on the role of Standardization provides a significant im-
implementation languages, analogous to the petus for further progress because it codifies
way that third-generation programming lan- best practices, enables and encourages reuse,
guages displaced assembly languages. With and facilitates interworking between comple-
complete code generation, there is rarely, if mentary tools. It also encourages specializa-
ever, a need to examine or modify the gener- tion, which leads to more sophisticated and
ated program directly—just as there is rarely a more potent tools.
need to examine or modify the machine code Still, with all the benefits of automation and
that a compiler produces. standardization, model-driven methods are only
Automatically verifying models means using as good as the models they help us construct.
a computer to analyze the model for the pres-
ence of desirable properties and the absence of The quality of models
undesirable ones. This can take many different Models and modeling have been an essential
forms, including formal (mathematical) analy- part of engineering from antiquity (Vitruvius, a
ses such as performance analysis based on Roman engineer from the first century B.C., dis-
queuing theory or safety-and-liveness property cusses the effectiveness of models in the world’s
checking. Most often, though, it means execut- oldest known engineering textbook6). Engineer-
ing (simulating) models on a computer as an ing models aim to reduce risk by helping us bet-
empirical approach to verification. In all cases, ter understand both a complex problem and its
it is critical to be able to do this on highly ab- potential solutions before undertaking the ex-
stract and incomplete models that arise early in pense and effort of a full implementation. In

September/October 2003 IEEE SOFTWARE 21


contrast, large software projects typically in- even a very precise and detailed scale model
volve great uncertainty about the design’s viabil- constructed out of balsa wood.
The rejection of ity until the final implementation phases— Finally, a model must be inexpensive—that
unfortunately, this is when the cost of fixing fun- is, it must be significantly cheaper to construct
modeling for damental design flaws is greatest. and analyze than the modeled system.
software is To be useful and effective, an engineering Probably the main reason why software
model must possess, to a sufficient degree, the modeling techniques had limited success in the
ironic when you following five key characteristics. The most past is that the models often failed to meet one
consider that important is abstraction. A model is always a or more of the criteria just listed. In particular,
software is the reduced rendering of the system that it repre-
sents. By removing or hiding detail that is ir-
the techniques tended to be weak in terms of
accuracy (which also meant that the models
engineering relevant for a given viewpoint, it lets us un- weren’t very useful for prediction). In part,
medium best derstand the essence more easily. Considering this is because it wasn’t always clear how the
the steady demand for ever-more sophisticated concepts used to express the models mapped
positioned to functionality from our software systems, ab- to the underlying implementation technologies
benefit from it. straction is almost the only available means of such as programming language constructs, op-
coping with the resulting complexity. erating system functions, and so forth. This se-
The second key characteristic is under- mantic gap was exacerbated if the modeling
standability. It isn’t sufficient just to abstract language was not precisely defined, leaving
away detail; we must also present what re- room for misinterpretation.
mains in a form (for example, a notation) that Also, because the models weren’t formally
most directly appeals to our intuition. Under- connected to the actual software, there was no
standability is a direct function of the expres- way of ensuring that the programmers followed
siveness of the modeling form used (expres- the design decisions captured in a model during
siveness is the capacity to convey a complex implementation. They would often change de-
idea with little direct information). A good sign intent during implementation—thereby in-
model provides a shortcut by reducing the validating the model. Unfortunately, because the
amount of intellectual effort required for un- mapping between models and code is imprecise
derstanding. One reason why programs are and the code is difficult to comprehend, such di-
not particularly expressive, even when based gressions would remain undetected and could
on languages that support sophisticated ab- easily lead to downstream integration and main-
stractions, is that they require too much de- tenance problems. (Changing design intent isn’t
tailed parsing of text to be properly under- necessarily a bad thing, but it is bad if the
stood. Classical programming statements change goes unobserved.) Given these difficul-
assault the reader with a profusion of syntac- ties, many software practitioners felt that soft-
tical detail assembled according to intricate ware models were untrustworthy, merely adding
lexical rules. The amount of information that useless overhead to their already difficult task.
must be absorbed and recognized to under- This rejection of modeling for software is
stand linear programs is enormous and re- particularly ironic when you consider that
quires significant intellectual effort. software is the engineering medium best posi-
The third key characteristic of useful mod- tioned to benefit from it. This is because it is
els is accuracy. A model must provide a true- possible to gradually evolve an abstract soft-
to-life representation of the modeled system’s ware model into the final product through a
features of interest. process of incremental refinement, without re-
Fourth is predictiveness. You should be able quiring a change in skills, methods, concepts,
to use a model to correctly predict the modeled or tools. The advantage of this is self-evident:
system’s interesting but nonobvious properties, there are no risk-laden semantic gaps to over-
either through experimentation (such as by ex- come when transferring a design into produc-
ecuting a model on a computer) or through tion. Model accuracy is guaranteed because
some type of formal analysis. Clearly, this de- the model eventually becomes the system that
pends greatly on the model’s accuracy and it was modeling. Furthermore, it is particu-
modeling form. For instance, a mathematical larly conducive to an incremental iterative de-
model of a bridge is much better at predicting velopment style that is optimal when building
the maximum allowable load on a bridge than complex engineering systems, because there

22 IEEE SOFTWARE h t t p : / / c o m p u t e r. o r g / s o f t w a r e
are no conceptual discontinuities that preclude This is a particularly important factor to
backtracking. This unique property of soft- consider for model-driven systems that are
ware models is another cornerstone of MDD. based on the notion of customizable transfor- Experience
mation “templates.” Such templates capture
The pragmatics rules for translating models into correspon- with MDD in
Many software practitioners, when first ding code. By exposing these to developers, it industrial
faced with the notion of MDD, express con- is possible to streamline the generated code for
cern about the technical difficulties involved in specific target environments. This is a highly
settings
translating models into code. Will the code be appealing and useful capability, but it must be indicates
fast enough and compact enough? Will it be a
correct rendering of design intent? These, of
matched by a similar facility for specifying in-
verse transformations, or model observability
that code
course, are the very same questions that were will most certainly be an issue. efficiency and
asked when compilers were introduced more Also related to model-level observability are correctness
than 40 years ago. Although they were valid two other critical facilities: model mergers and
questions to ask at the time, it is worth noting model difference tools. These tools are typically
are not the
that hardly anyone questions compiler tech- an integral part of configuration management primary
nology these days because it is quite mature
and extensively proven in practice.
systems that help us track different versions of
the same model. Model merging tools merge
challenges
In fact, experience with MDD in industrial two or more possibly overlapping models into of MDD.
settings indicates that code efficiency and cor- one. In contrast to source-code merging used
rectness, although very important, are not the for traditional text-based programming lan-
top-priority or even the most technically chal- guages, a model-level merge is much more com-
lenging issues associated with MDD. In fact, plex because it requires a deeper understanding
most standard techniques used in compiler of the more complex semantics of the modeling
construction can also be applied directly to language. The result must be a well-formed
model-based automatic code generation. model. Furthermore, the tools must report any
problems in a form that is meaningful to the
Model-level observability modeler. Model difference tools identify the dif-
Like all compilers, automatic code genera- ference between two models (usually two dif-
tors are idiosyncratic and often generate pro- ferent versions of the same model). They too
gram code that, as a result of various internal must work at a semantically meaningful level.
optimizations, is not easily traceable to the
original model. Thus, if an error is detected in Model executability
the generated program, finding the place in the One of the fundamental ways that we learn
model that must be fixed either at compile time is through experimentation—that is, through
or runtime might be difficult. In traditional model execution (David Harel compares mod-
programming languages, we expect compilers els that can’t be executed to cars without en-
to report errors in terms of the original source gines). One important advantage of executable
code and, for runtime errors, we now expect a models is that they provide early direct experi-
similar capability from our debuggers. ence with the system being designed. (When
The need for such facilities for models is learning a new programming language, we are
even greater because the semantic gap between always inspired by the successful run of our
the modeling language’s high-level abstrac- first trivial “hello world” program. Simple as it
tions and the implementation code is wider. is, that experience raises our confidence level
This means that model-level error reporting and gives us a reference point for further explo-
and debugging facilities (in essence, “decom- ration.) The intuition gained through experi-
pilers”) must accompany practical automatic mentation is the difference between mere for-
code generators. Otherwise, the practical diffi- mal knowledge and understanding.
culties encountered in diagnosing problems A common experimental scenario with exe-
could be significant enough to nullify much of cutable models involves refining some high-
MDD’s advantage. Programmers faced with risk aspect of a candidate solution down to a
fixing code that they don’t understand will relatively fine level of detail, while other parts
easily break it and will likely be discouraged of the model remain sketchy or even unde-
from relying on models in the future. fined. This means that even incomplete models

September/October 2003 IEEE SOFTWARE 23


should be executable, as long as they are well parts of a model, and the tools and methods
formed. It also requires suitable runtime sys- must scale up to such situations.
It is now tem support: the ability to start, stop, and re- The important metrics of concern here are
sume a model run at any meaningful point; to compilation time and system size. We can divide
common “steer” it in the desired direction by simulating compilation time into two separate parts: full-
knowledge inputs at appropriate points in space and time; system generation time and the turnaround time
and to easily attach automated instrumenta- for small incremental changes. Perhaps surpris-
that modern tion packages to it. Finally, it is also extremely ingly, the latter is much more important because
optimizing useful for developers to be able to execute a of its greater impact on productivity. Namely,
compilers can model in a simulation environment (for exam-
ple, on a development workstation), on the ac-
small changes are far more frequent during de-
velopment than full-system recompiles. There-
outperform tual target platform, or—and this is the most fore, if a small, localized change requires regen-
most useful—on some combination of the two. erating a disproportionately large part of the
code, development can slow to an unacceptable
practitioners Efficiency of generated code pace. This is particularly true in the latter phases
when it comes As mentioned earlier, one of the first ques- of the development cycle, when programmers
to code tions asked about MDD is how the automati-
cally generated code’s efficiency compares to
make many small changes as they fine-tune the
system. To keep this overhead low, it is crucial
efficiency. handcrafted code. This is nothing new; the same for the code generators to have sophisticated
question was asked when compilers were first in- change impact analysis capabilities that mini-
troduced. The concern is the same as before: hu- mize the amount of code regeneration.
mans are creative and can often optimize their We can divide the system generation process
code through clever tricks in ways that machines into two phases. First, code generators translate
cannot. Yet, it is now common knowledge that the model into a program in some programming
modern optimizing compilers can outperform language and then compile the program using
most practitioners when it comes to code effi- standard compilers for that language. After com-
ciency. Furthermore, they do it much more reli- piling the code, they link it to the appropriate li-
ably (which is another benefit of automation). braries in the usual way. With modern automatic
We can decompose code efficiency into two code generation technology, the compilation
separate areas: performance (throughput) and phase is significantly longer. Typically, compila-
memory utilization. Current model-to-code tion is an order of magnitude longer than code
generation technologies can generate code with generation. This means that the overhead of au-
both performance and memory efficiency fac- tomatic code generation is almost negligible
tors that are, on average, within 5 to 15 per- compared to the usual overhead of compilation.
cent (better or worse) of equivalent manually Regarding size, the largest systems devel-
crafted systems. And, of course, we can only oped to date using full MDD techniques have
expect the situation to improve as the technol- involved hundreds of developers working on
ogy evolves. In other words, for the vast ma- models that translate into several million lines
jority of applications, efficiency is not an issue. of standard programming language.
Still, there might be occasional critical cases
where manually crafted code might be neces- Integration with legacy environments and
sary in specific parts of the model. Such hot systems
spots are often used as an excuse to reject MDD A prudent and practical way to introduce
altogether, even when it involves a very small new technology and techniques into an exist-
portion of the complete system—the proverbial ing production environment is to apply them
“baby and bathwater” scenario. A useful MDD to a smaller-scale project such as a relatively
system will allow for seamless and overhead- low-profile extension to some legacy system.
free embedding of such critical elements. This implies not only that the new software
must work within legacy software but also
Scalability that the development process and develop-
MDD is intended for—and most beneficial ment environment used to produce it must be
in—large-scale industrial applications. This integrated into the legacy process and legacy
sometimes involves hundreds of developers development environment.
working on hundreds of different but related This is not only a question of mitigating risk

24 IEEE SOFTWARE h t t p : / / c o m p u t e r. o r g / s o f t w a r e
but also of leveraging previous (usually signifi- About the Author
cant) investments into such processes and envi-
Bran Selic is principal engineer at IBM Rational Software in Kanata, Ontario, Canada. He
ronments. For example, a useful MDD tool is also cochair of the OMG task force that is finalizing the UML 2.0 modeling language stan-
should be able to exploit a range of different dard. He received his Magister Ing. Degree in systems theory and Dipl. Ing. Degree in electri-
compilers, build utilities, debuggers, code ana- cal engineering from the University of Belgrade, Yugoslavia. He is a member of the IEEE and
ACM. Contact him at IBM Rational Software, 770 Palladium Dr., Kanata, Ontario, Canada K2V
lyzers, and software versioning control systems 1C8; bselic@ca.ibm.com.
rather than requiring the purchase of new ones.
Furthermore, this type of integration should
work “out of the box” and should generally
not require custom “glue” code and tool ex-
2. P. Kruchten, The Rational Unified Process, Addison-
pertise. Fortunately, most legacy development Wesley, 1999.
tools have evolved along similar lines, support- 3. Unified Modeling Language, ver. 1.4, Object Manage-
ment Group, 2002.
ing similar usage paradigms so that it is usually
4. Meta-Object Facility (MOF), ver. 1.4, Object Management
possible to construct MDD tools that can ac- Group, 2002; www.omg.org/cgi-bin/doc?formal/2002-
cess these capabilities in a generic fashion. 04-03.
Last but not least, an MDD project must be 5. Common Warehouse Metamodel (CWM) Specification,
ver. 1.1, Object Management Group, 2003; www.omg.org/
able to take advantage of legacy code libraries cgi-bin/doc?formal/03-03-02.
and other legacy software. These often capture 6. Vitruvius, The Ten Books on Architecture, Dover Publi-
cations, 1960.
domain-specific knowledge garnered over
7. B. Selic, G. Gullekson, and P.W. Ward, Real-Time Ob-
many years and often represent an organiza- ject-Oriented Modeling, John Wiley & Sons, 1994.
tion’s prime intellectual property. This can be
accomplished either using customizable code
For more information on this or any other computing topic, please visit our
generators or by allowing direct calls to such Digital Library at http://computer.org/publications/dlib.
utilities from within the model. For example, a
model that uses Java to specify the details of
actions along a statechart transition can sim-
ply make the appropriate Java calls without
any intervening translation or having to go New from The MIT Press
through a layer interface.
Software Ecosystem

M
Understanding an Indispensable
DD’s success is not predicated only Technology and Industry
on resolving obvious technical is- David G. Messerschmitt
and Clemens Szyperski
sues such as defining suitable mod-
“Required reading for any serious
eling languages and automatic code genera- student of the computer industry and
tion. Our experience with these methods in its effects on business, innovation,
industrial environments on large-scale soft- and economic growth.”
ware projects clearly indicates that solving the — Nicholas Economides, New York
University, and Director, NET Institute
unique pragmatic issues described in this arti- 432 pp., 49 illus. $45
cle is at least equally, if not more, important.7
Unless the experience of applying MDD is ac-
ceptable from the day-to-day perspective of the
Software
individual practitioner and project manager, it Development Failures
will be rejected despite its obvious potential for Kweku Ewusi-Mensah
yielding major productivity and reliability ben- “Makes a compelling argument for
learning from software development
efits. Fortunately, over the past decade, numer- failures, so that the same mistakes
ous commercial vendors have developed tools aren’t repeated in future projects.”
that address these issues successfully. The time — Mark Keil, Georgia State University
288 pp., 5 illus. $35
for MDD has come.

To order call 800-405-1619.


References Prices subject to change without notice.
1. R. Pool, Beyond Engineering: How Society Shapes http://mitpress.mit.edu
Technology, Oxford Univ. Press, 1997.

September/October 2003 IEEE SOFTWARE 25

You might also like