MODEL-DRIVEN ENGINEERING in Practice
The $800-Million Bombshell (Motivation)
• The following was the code for controlling long-distance phone traffic routing in USA:
• …switch (caseIndex) {case‘A’: route = routeA;
…break;
…case‘M’: route = routeM;
…case‘N’: route = routeN;
…break;
…}
Missing “break” statement!
When this code ran (in 1990), the entire US Northeast lost long-distance phone service
Engineering ModelA reduced representation of some system that highlights the properties of interest from a given viewpoint
Functional ModelModeled system
We don’t see everything at once We use a representation (notation) that is easily understood for
the purpose on hand
Models vs. Systems
Differences due to:• Unique properties of actual
construction materials• Construction methods• Scaling-up effects• Skill sets/technologies• Misunderstandings
Can lead to serious errors and discrepancies in the realization
Characteristics of Useful Models• Abstract
• Emphasize important aspects while removing irrelevant ones
• Understandable• Expressed in a form that is readily understood by
observers• Accurate
• Faithfully represents the modeled system• Predictive
• Can be used to answer questions about the modeled system
• Inexpensive• Much cheaper to construct and study than the
modeled systemTo be useful, engineering models must satisfy all of these characteristics!
Model Transformations• Computation-
independent Model• Uses natural language• Ex: state-chart
diagram
CIM
• Platform-independent Model
• Does not specify any technology
PIM
• Platform-specific Model• Built for a specific
technology• When technology evolves, a
new PSM can be generated rather than rewriting it
PSM
Business Analyst
Architect / Designer
Developer / Tester
Machine Code
Impossible?
The Abstraction Gap• Middleware makes MDA a potential
reality
Level of Abstraction
Generators
1
0..*
security
mortgages
1
0..*
borrower
mortgages
10..*
ownerhouses
House
-value:Money
Person
-ssn:Integer-salary:Money
+getMortgage(sum:Money,security:House):Mortgage
Mortgage
-principal:Money-monthlyPayment:Money-start:Date-end:Date
Machine Code with Operating System
Impractical?Use Operating System facilities
Unlikely?Use Middleware
Practical(ly)Middleware with Framework
Today!
A b
s t r
a c
t i o
n G
a p
Model Execution
X = cos (h + p/2)+ x*5
X = cos (h + p/2)+ x*5
? By formal analysis mathematical methods reliable (theoretically) software is very difficult to
model mathematically!?
X = cos (h + p/2)+ x*5
X = cos (h + p/2)+ x*5
By experimentation (execution) more reliable than inspection direct experience/insight
X = cos (h + p/2)+ x*5
X = cos (h + p/2)+ x*5
? By inspection mental execution unreliable
MDE Prospects• The problem:
• We cannot keep implementing our applications using the programming technologies of the late Fifties’
• The demands on functionality, reliability, dependability, availability, security, and performance demanded of modern software.
• We need to, can do, and have already done better!
• MDE:• Increased levels of abstraction• Open unified standards• Increased levels of automation
Primary Forms of Automation for MDE
• Computer-based validation • Formal methods (qualitative and quantitative)
• Computer-based testing• Automated test generation, setup, and execution
• Computer-based model execution• Particularly execution of abstract and incomplete
models-- when most of the important decisions are made
• Model transformations• Code generation, between PSMs, …
MDE - Case StudyProject Description• A simple web-based J2EE e-commerce system
(Pet Store)• Users can sign into a system and manage their
accounts.• Users can browse a catalogue of pets on the
web site (such as birds, fish or reptiles).• Shopping cart functionality: Users can add
pets to their shopping cart and manage their shopping carts.
• Order functionality: Users can place an order for the contents of their shopping carts.
• Web services. Users can query orders via a web service.
MDE - Case StudyTeams Description• 2 development teams
• Traditional development lifecycle• Model-driven Development style
• 1 senior J2EE architect + 2 experienced J2EE programmers per team
• Each team uses the same HTML, images and database schema.
• MDA team was required to use an MDA tool• Traditional team was required to use leading J2EE IDE• Both teams must use EJB in their code bases• No further constraints
Savings Achieved0% 36% 46% 28% No data
available
Total average savings achieved: 26%
Quantitative Resultsdevelopment hours spent by each team:
Team Original Estimated Hours
Actual Number of Hours
Traditional team 499 507,5
MDA team 422 330
this corresponds to a 35% increase in productivity when using MDA
Thank you!Hussein Alshkhir