ibm software group ® clic k to edit ma ster sub title styl e model-driven development bran selic...
TRANSCRIPT
IBM Software Group
®
Click to edit Master subtitle style
Model-Driven DevelopmentModel-Driven Development
Bran SelicIBM Distinguished Engineer
IBM Rational Software
Bran SelicIBM Distinguished Engineer
IBM Rational Software
22 IBM Software Group |
The $800M BombshellThe $800M Bombshell Deeply embedded in the software for controlling long-distance
phone traffic routing sat the following (kind of) code: …switch (caseIndex) {case‘A’: route = routeA;
…break;
…case‘M’: route = routeM;
…case‘N’: route = routeN;
…break;
…}
Deeply embedded in the software for controlling long-distance phone traffic routing sat the following (kind of) code: …switch (caseIndex) {case‘A’: route = routeA;
…break;
…case‘M’: route = routeM;
…case‘N’: route = routeN;
…break;
…}
Missing “break” Missing “break” statement!statement!
When this code ran (1990), the entire US Northeast lost long-distance phone service
When this code ran (1990), the entire US Northeast lost long-distance phone service
33 IBM Software Group |
A Skeptic’s View of Software Models…A Skeptic’s View of Software Models…
“…bubbles and arrows, as opposed to programs, …never crash”“…bubbles and arrows, as opposed to programs, …never crash”
-- B. Meyer“UML: The Positive Spin”
American Programmer, 1997
-- B. Meyer“UML: The Positive Spin”
American Programmer, 1997
MonitorPH
MonitorPH
RaisePH
RaisePH
ControlPH
ControlPH
PH reached XPH reached X
enableenable
disabledisable
Current PHCurrent PH
startstart
stopstop
Input valvecontrol
Input valvecontrol
44 IBM Software Group |
Models in Traditional EngineeringModels in Traditional Engineering As old as engineering (e.g., Vitruvius) Traditional means of reducing engineering risk
As old as engineering (e.g., Vitruvius) Traditional means of reducing engineering risk
55 IBM Software Group |
Engineering ModelsEngineering Models Engineering model:
A reduced representation of some system that highlights the properties of interest from a given viewpoint
Engineering model:A reduced representation of some system that highlights the properties of interest from a given viewpoint
Functional ModelFunctional ModelModeled systemModeled system
We don’t see everything at once We use a representation (notation) that is easily understood for
the purpose on hand
We don’t see everything at once We use a representation (notation) that is easily understood for
the purpose on hand
66 IBM Software Group |
How Engineering Models are UsedHow Engineering Models are Used
1. To help us understand complex systems Useful for both requirements and designs
Minimize risk by detecting errors and omissions early in the design cycle (at low cost)
• Through analysis and experimentation• Investigate and compare alternative solutions
To communicate understanding• Stakeholders: Clients, users, implementers, testers, documenters, etc.
2. To drive implementation The model as a blueprint for construction
1. To help us understand complex systems Useful for both requirements and designs
Minimize risk by detecting errors and omissions early in the design cycle (at low cost)
• Through analysis and experimentation• Investigate and compare alternative solutions
To communicate understanding• Stakeholders: Clients, users, implementers, testers, documenters, etc.
2. To drive implementation The model as a blueprint for construction
77 IBM Software Group |
Models versus SystemsModels versus Systems
Differences due to:
• Idiosyncrasies of actual construction materials
• Construction methods
• Scaling-up effects
• Skill sets/technologies
• Misunderstandings
Can lead to serious errors and discrepancies in the realization
Differences due to:
• Idiosyncrasies of actual construction materials
• Construction methods
• Scaling-up effects
• Skill sets/technologies
• Misunderstandings
Can lead to serious errors and discrepancies in the realization
.
...
88 IBM Software Group |
Characteristics of Useful ModelsCharacteristics 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 system
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 system
To be useful, engineering models must satisfy all of these characteristics!To be useful, engineering models must satisfy all of these characteristics!
99 IBM Software Group |
SC_MODULE(producer){sc_outmaster<int> out1;sc_in<bool> start; // kick-startvoid generate_data (){for(int i =0; i <10; i++) {out1 =i ; //to invoke slave;}}SC_CTOR(producer){SC_METHOD(generate_data);sensitive << start;}};SC_MODULE(consumer){sc_inslave<int> in1;int sum; // state variablevoid accumulate (){sum += in1;cout << “Sum = “ << sum << endl;}
SC_CTOR(consumer){SC_SLAVE(accumulate, in1);sum = 0; // initialize };SC_MODULE(top) // container{producer *A1;consumer *B1;sc_link_mp<int> link1;SC_CTOR(top){A1 = new producer(“A1”);A1.out1(link1);B1 = new consumer(“B1”);B1.in1(link1);}};
A Bit of Modern Software…A Bit of Modern Software…
Can you spot the Can you spot the architecture?architecture?
1010 IBM Software Group |
…and its UML Model…and its UML Model
«sc_ctor»«sc_ctor»consumerconsumer
«sc_ctor»«sc_ctor»consumerconsumer
«sc_ctor»«sc_ctor»producerproducer«sc_ctor»«sc_ctor»
producerproducerstart out1 in1
«sc_link_mp»
link1
Can you spot the Can you spot the architecture?architecture?
1111 IBM Software Group |
The Software and Its ModelThe Software and Its Model
«sc_ctor»«sc_ctor»consumerconsumer
«sc_ctor»«sc_ctor»consumerconsumer
«sc_ctor»«sc_ctor»producerproducer«sc_ctor»«sc_ctor»
producerproducerstart out1 in1
«sc_link_mp»
link1
SC_MODULE(producer){sc_outmaster<int> out1;sc_in<bool> start; // kick-startvoid generate_data (){for(int i =0; i <10; i++) {out1 =i ; //to invoke slave;}}SC_CTOR(producer){SC_METHOD(generate_data);sensitive << start;}};SC_MODULE(consumer){sc_inslave<int> in1;int sum; // state variablevoid accumulate (){sum += in1;cout << “Sum = “ << sum << endl;}
SC_CTOR(consumer){SC_SLAVE(accumulate, in1);sum = 0; // initialize };SC_MODULE(top) // container{producer *A1;consumer *B1;sc_link_mp<int> link1;SC_CTOR(top){A1 = new producer(“A1”);A1.out1(link1);B1 = new consumer(“B1”);B1.in1(link1);}};
1212 IBM Software Group |
refine
NotStarted
Started
start
producer
Model Evolution: RefinementModel Evolution: Refinement
Models can be refined continuously until the specification is complete
Models can be refined continuously until the specification is complete
«sc_method»producer
«sc_method»producer
start out1
NotStarted
Started
start
producer
St1 St2
void generate_data(){for (int i=0; i<10; i++) {out1 = i;}}
/generate_data( )
1313 IBM Software Group |
The Remarkable Thing About SoftwareThe Remarkable Thing About Software
Software has the rare property that it allows us to directly evolve models into full-fledged implementations without changing the engineering medium, tools, or methods!
Software has the rare property that it allows us to directly evolve models into full-fledged implementations without changing the engineering medium, tools, or methods!
This ensures perfect accuracy of software models; since the model and the system that it models are the same thingThe model evolves into the system it was modeling
This ensures perfect accuracy of software models; since the model and the system that it models are the same thingThe model evolves into the system it was modeling
1414 IBM Software Group |
Model-Driven Style of Development (MDD)Model-Driven Style of Development (MDD)
An approach to software development in which the focus and primary artifacts of development are models (as opposed to programs)
Based on two time-proven methods
An approach to software development in which the focus and primary artifacts of development are models (as opposed to programs)
Based on two time-proven methods
SC_MODULE(producer)
{sc_inslave<int> in1;
int sum; //
void accumulate (){
sum += in1;
cout << “Sum = “ << sum << endl;}
«sc_module»«sc_module»producerproducer
start out1
(1) ABSTRACTION (2) AUTOMATION
«sc_module»«sc_module»producerproducer
start out1
SC_MODULE(producer)
{sc_inslave<int> in1;
int sum; //
void accumulate (){
sum += in1;
cout << “Sum = “ << sum << endl;}
Realm of modelinglanguages
Realm of tools
1515 IBM Software Group |
OMG’s Model-Driven Architecture (MDA)OMG’s Model-Driven Architecture (MDA) An OMG initiative
A framework for a set of open standards in support of MDD
An OMG initiative A framework for a set of open standards in support of MDD
MDA
OpenOpenStandardsStandards
«sc_module»«sc_module»producerproducer
start out1
(1) ABSTRACTION (2) AUTOMATION
«sc_module»«sc_module»producerproducer
start out1
Standards for:Standards for:
•Modeling languagesModeling languages
•Model transformationsModel transformations
•Software processesSoftware processes
•Model interchange…Model interchange…
1616 IBM Software Group |
ABSTRACTION: The Modeling Language ABSTRACTION: The Modeling Language DomainDomain
1717 IBM Software Group |
Modeling versus Programming LanguagesModeling versus Programming Languages Cover different ranges of abstraction Cover different ranges of abstraction
Level of Level of AbstractionAbstraction
high
low
ProgrammingLanguages
(C/C++, Java, …)
ModelingModelingLanguagesLanguages
(UML,…)(UML,…)
ModelingModelingLanguagesLanguages
(UML,…)(UML,…)
LOdata layout, arithmeticaland logicaloperators,etc.
HIstatecharts,interactiondiagrams,architecturalstructure, etc.
1818 IBM Software Group |
(Any) ActionLanguage
Covering the Full Range of DetailCovering the Full Range of Detail
Level of Level of AbstractionAbstraction
high
low
ProgrammingLanguages
(C/C++, Java, …)
ModelingModelingLanguagesLanguages
(UML,…)(UML,…)
ModelingModelingLanguagesLanguages
(UML,…)(UML,…)
implementation level detail(applicationspecific)
Fine-grainlogic,arithmeticformulae,etc.
Fine-grainlogic,arithmeticformulae,etc.
1919 IBM Software Group |
Example: Combination of LanguagesExample: Combination of Languages
Combination of languages and representations Each optimized for its purpose
Combination of languages and representations Each optimized for its purpose
NotStarted
Started
start
producer
St1 St2
void generate_data(){for (int i=0; i<10; i++) {out1 = i;}}
/generate_data( )
2020 IBM Software Group |
MDD Modeling Language RequirementsMDD Modeling Language Requirements
High expressive power Concepts closer to domain and distant from the
implementation technology “platform independent” concepts
Different domains need different concepts need domain-specific languages
Adequate semantic precision and clarity Models must be as accurate as their intended purpose
requires i.e., from “sketching” through code generation
High expressive power Concepts closer to domain and distant from the
implementation technology “platform independent” concepts
Different domains need different concepts need domain-specific languages
Adequate semantic precision and clarity Models must be as accurate as their intended purpose
requires i.e., from “sketching” through code generation
2121 IBM Software Group |
Domain-Specific LanguagesDomain-Specific Languages Where do we start? DSLs from “scratch”
Pro: - Highly optimized set of concepts
Con: - Need to reinvent many wheels (e.g., objects, interactions…)- Need to learn a new language for every domain- Need to provide full tool support for every domain
Example: SDL: a DSL for describing telecom protocols (refined since
1970) Latest version: UML profile (Z.109)
Where do we start? DSLs from “scratch”
Pro: - Highly optimized set of concepts
Con: - Need to reinvent many wheels (e.g., objects, interactions…)- Need to learn a new language for every domain- Need to provide full tool support for every domain
Example: SDL: a DSL for describing telecom protocols (refined since
1970) Latest version: UML profile (Z.109)
2222 IBM Software Group |
The Languages of MDAThe Languages of MDA Set of modeling languages for specific purposes Set of modeling languages for specific purposes
Meta ObjectMeta ObjectFacility (MOF)Facility (MOF)Meta ObjectMeta Object
Facility (MOF)Facility (MOF)
A modeling language for defining modeling languages
A modeling language for defining modeling languages
GeneralGeneralStandard UMLStandard UML
GeneralGeneralStandard UMLStandard UML
Common Common Warehouse Warehouse
Metamodel (CWM)Metamodel (CWM)
Common Common Warehouse Warehouse
Metamodel (CWM)Metamodel (CWM)
etc.etc.etc.etc.
For general OO modelingFor general OO modeling
For exchanging information about businessdata
For exchanging information about businessdata
Real-TimeReal-Timeprofileprofile
Real-TimeReal-Timeprofileprofile
EAI profileEAI profileEAI profileEAI profile
SoftwareSoftwareprocess profileprocess profile
SoftwareSoftwareprocess profileprocess profile
etc.etc.etc.etc.
2323 IBM Software Group |
AUTOMATION: The Tools DomainAUTOMATION: The Tools Domain
2424 IBM Software Group |
Primary Forms of Automation for MDDPrimary Forms of Automation for MDD
Model transformations Code generation, for analysis, for selective viewing,…
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, for analysis, for selective viewing,…
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
2525 IBM Software Group |
NotStarted
Started
start
producer
St1 St2
void generate_data(){for (int i=0; i<10; i++) {out1 = i;}}
/generate_data( )
«sc_ctor»producer«sc_ctor»producer
start out1
main () {
BitVector typeFlags (maxBits);
char buf [1024];
cout << msg;
while (cin >> buf) {
for (int i = 0;i<maxBits;i++)
if (strcmp(typeTbl[i],buf)==0)
{typeFlags += i;
break;}
if ...
program (e.g., C++)
What is Automatic Code Generation?What is Automatic Code Generation? Automated translation into semantically equivalent programs Automated translation into semantically equivalent programs
Model transformer
2626 IBM Software Group |
Model ExecutionModel Execution
cos
cos
?? By formal analysis mathematical methods reliable (theoretically) software is very difficult to
model mathematically!
By formal analysis mathematical methods reliable (theoretically) software is very difficult to
model mathematically! ??
cos
cos
By experimentation (execution) more reliable than inspection direct experience/insight
By experimentation (execution) more reliable than inspection direct experience/insight
cos
cos
?? By inspection
mental execution unreliable
2727 IBM Software Group |
Automatic Code Gen: State of the ArtAutomatic Code Gen: State of the Art Efficiency
performance and memory utilization:within ±5-15% of equivalent manually coded system
Scalability compilation time (system and incremental change):
within 5-20% of manual process system size:
• Complete systems in the order of 4MLOC have been constructed using full code generation
• Teams of over 400 developers working on a common model
Efficiency performance and memory utilization:
within ±5-15% of equivalent manually coded system Scalability
compilation time (system and incremental change):within 5-20% of manual process
system size:• Complete systems in the order of 4MLOC have been constructed using full code
generation• Teams of over 400 developers working on a common model
2828 IBM Software Group |
Automating Engineering AnalysisAutomating Engineering Analysis
Inter-working of specialized tools via shared standards Inter-working of specialized tools via shared standards
Model EditingModel EditingToolTool
55
3.13.1
44
Model AnalysisModel AnalysisToolTool
AutomaticallyAutomaticallyderived analysisderived analysis
modelmodel
AutomaticallyAutomaticallyderived analysisderived analysis
modelmodel
Inverse automatedInverse automatedmodel conversionmodel conversionInverse automatedInverse automatedmodel conversionmodel conversion
2.52.5
QoS Annotations QoS Annotations OverlayOverlay
QoS Annotations QoS Annotations OverlayOverlay
2929 IBM Software Group |
Example: Schedulability AnnotationsExample: Schedulability Annotations
Sensors:SensorInterface
TelemetryGatherer:DataGatherer
«SAResource»
SensorData:RawDataStorage
TelemetryDisplayer: DataDisplayer
TelemetryProcessor:DataProcessor
Display:DisplayInterface
TGClock : Clock
TGClock : Clock
A.1:gatherData ( )
C.1:displayData ( )
B.1:filterData ( )
TGClock : Clock
A.1.1:main ( )
A.1.1.1: writeStorage ( )
B.1.1 : main ( )
B.1.1.1: readStorage ( )C.1.1.1: readStorage ( )
C.1.1 : main ( )
«SASituation»
{SACapacity=1,
SAAccessControl=PriorityInheritance}
«SASchedulable»
«SASchedulable» «SASchedulable»
«SATrigger»{SASchedulable=$R1,
RTat=('periodic',100,'ms')}«SAResponse»
{SAAbsDeadline=(100,'ms')}
«SAAction»{SAPriority=2,SAWorstCase=(93,'ms'),RTduration=(33.5,'ms')}
«SAAction»{RTstart=(16.5,'ms'),RTend=(33.5,'ms')}
«SATrigger»{SASchedulable=$R2,
RTat=('periodic',60,'ms')}«SAResponse»
{SAAbsDeadline=(60,'ms')}
«SATrigger»{SASchedulable=$R3,
RTat=('periodic',200,'ms')}«SAResponse»
{SAAbsDeadline=(200,'ms')}
«SAResponse»{SAPriority=3,SAWorstCase=(177,'ms'),RTduration=(46.5,'ms')}
«SAAction»{RTstart=(10,'ms'),RTend=(31.5,'ms')}
«SAAction»{RTstart=(3,'ms'),RTend=(5,'ms')}
«SAResponse»{SAPriority=1,SAWorstCase=(50.5,'ms'),RTduration=(12.5,'ms')}
ResultResult
3030 IBM Software Group |
Example: Deployment SpecificationExample: Deployment Specification
«SAEngine»{SARate=1,
SASchedulingPolicy=FixedPriority}
:Ix86Processor
«SASchedulable»
TelemetryGatherer:DataGatherer
«SASchedulable»
TelemetryDisplayer: DataDisplayer
«SASchedulable»
TelemetryProcessor:DataProcessor
«SAResource»
SensorData:RawDataStorage
«SAOwns»
«GRMdeploys»
3131 IBM Software Group |
Sensors:SensorInterface
TelemetryGatherer:DataGatherer
«SAResource»
SensorData:RawDataStorage
TelemetryDisplayer: DataDisplayer
TelemetryProcessor:DataProcessor
Display:DisplayInterface
TGClock : Clock
TGClock : Clock
A.1:gatherData ( )
C.1:displayData ( )
B.1:filterData ( )
TGClock : Clock
A.1.1:main ( )
A.1.1.1: writeStorage ( )
B.1.1 : main ( )
B.1.1.1: readStorage ( )C.1.1.1: readStorage ( )
C.1.1 : main ( )
{SACapacity=1,
SAAccessControl=PriorityInheritance}
«SASchedulable»
«SASchedulable» «SASchedulable»
«SATrigger»
RTat=('periodic',100,'ms')}«SAResponse»
{SAAbsDeadline=(100,'ms')}
«SASituation»
«SAAction»{SAPriority=2,SAWorstCase=(93,'ms'),RTduration=(33.5,'ms')}
«SAAction»{RTstart=(16.5,'ms'),RTend=(33.5,'ms')}
«SATrigger»
RTat=('periodic',60,'ms')}«SAResponse»
{SAAbsDeadline=(60,'ms')}
«SATrigger»
RTat=('periodic',200,'ms')}«SAResponse»
{SAAbsDeadline=(200,'ms')}
«SAResponse»{SAPriority=3,SAWorstCase=(177,'ms'),RTduration=(46.5,'ms')}
«SAAction»{RTstart=(10,'ms'),RTend=(31.5,'ms')}
«SAAction»{RTstart=(3,'ms'),RTend=(5,'ms')}
«SAResponse»{SAPriority=1,SAWorstCase=(50.5,'ms'),RTduration=(12.5,'ms')}
Example: Analysis ResultsExample: Analysis Results
{SASchedulable=$true,
{SASchedulable=$true
{SASchedulable=$true
3232 IBM Software Group |
ConclusionConclusion
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! MDA:
Increased levels of abstraction Increased levels of automation Open standards
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! MDA:
Increased levels of abstraction Increased levels of automation Open standards