Slides from the talk "Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development". Summer course on "Data Management". University of Santander (Spain), July 2011)
Micro-Scholarship, What it is, How can it help me.pdf
MDE first glance
1. Gestión Avanzada de Datos
@Santander – 21 July, 2011
Model-Driven Engineering:
a first glance at a ¿new? way of conceiving
software development
Juan M. Vara
juanmanuel.vara@urjc.es
Kybele Research Group
University Rey Juan Carlos
(Madrid - Spain)
2. Agenda
Motivation
(Meta)Modeling
MDA
Putting MDE to work
Conclusion
2 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
3. Motivation
Software Complexity
• Many modern software systems are reaching levels of complexity
encountered in biological systems
– Systems of systems each of which may include of millions of lines of code
– … any one of which might be the culprit that brings down the entire system
Mariner (1962)
• 18.5$ millions
• Programmer incorrectly transcribed a handwritten
formula (period instead of comma in FORTRAN loop)
• Furthermore, we can only see an increase in complexity of
software systems due to:
– Growing demand for greater and more sophisticated functionality
• Given our current track record, how will we cope with this rise in
complexity?
3 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
4. Motivation
Software Complexity
Essential Accidental
First, distinguising what can be simplified
Complexity Complexity
• Essential complexity: we have a hard problem
– Inherent to the problem
– Cannot be sidestepped or eliminated by technology or method
– E.g., geospatial applications are inherently more “complex” than standard
“forms over data” applications
• Accidental complexity: we have made a problem hard
– Due to the use of inappropriate technologies or methods
– It happens because someone didn't find the simplest way to implement a
specified set of features
– Might be eliminated by good design, or good redesign.
– E.g., banks legacy systems programmed in COBOL
4 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
5. Motivation
Software Complexity
Modern software development
suffers from an excess of
accidental complexity
How can we deal with this rise
in complexity?
5 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
6. Motivation
Software Complexity
Can you see the
underlying
structure???
6 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
7. Motivation
Software Complexity
Can you see the
underlying
structure???
Much better,
isn’t it???
7 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
8. Motivation
Software Complexity
Clearly, models help on
simplifying software
development by raising the
level of abstraction at which
software is conceived
8 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
9. Motivation
Modeling in other disciplines
• Modeling has been widely
used in Engineering
– Whith specification
purposes
Structure and behavior Architecture
Interacting with stakeholders
– For reasoning about the Avionics
system
Detecting design errors
Infer and test properties
Prototyping (simulation)
– As a guide towards
implementation …
9 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
10. Motivation
What happens with models in Software Engineering??
Used (at best) with documentation purposes
There is a big gap between the models and the
underlying implementation
Models are not No way of ensuring No tools or
updated with design programmers followed the
changes made by design decissions captured in languages to
programmers models handle models
Are we really doing Software Engineering??
10 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
11. Motivation
Let’s put models to work in Software Engineering
The 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”
[John Hogg, 2003]
Registrar Pago Seleccionar Imágenes Guardar Resultado
Mostrar Resultados
(SIW)
LAIM
Validar Usuario <<WS>> Del Procesamiento
Validar Tarjeta Recibir Criterios
de Crédito de Búsqueda
Imágenes
Criterios
<<WS>>
SACim
Recibir Imágenes
<<WS>>
Obtener Imágenes
Resultados
Imágenes Imágenes Obtenidos
<<<WS>>
SPim
“from (models) human-readable to
Realizar Procesamiento
de Imágenes
Registrar Pago Seleccionar Imágenes
Mostrar Resultados
Guardar Resultado
computer-understandable”
(SIW)
LAIM
Validar Usuario Del Procesamiento
Validar Tarjeta
de Crédito Recibir Criterios
Imágenes
de Búsqueda
Criterios [J. Bézivin]
Recibir Imágenes
SACim
Obtener Imágenes
Resultados
Imágenes Imágenes Obtenidos
SPim
Realizar Procesamiento
de Imágenes
11 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
12. Motivation
Model-Driven Engineering (and related disciplines)
MDA DSL ADM Boost the role of models and
modelling activities at the
MIC MDSD different steps of the
MSE development cycle
FROM CODING to
MODELLING
Model-Driven
Component-based Engineering
Software Engineering
Structured
Programming Object-Oriented Aspect-Oriented
Programming Programming
Assembly
Raising the abstraction Languages
level in Software Development
12 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
13. Motivation
Model-Driven Engineering (and related disciplines)
MDA DSL ADM Boost the role of models and
modelling activities at the
MIC MDSD different steps of the
MSE development cycle
ROLE CODING to
FROM of LEVEL of
MODELLING
MODELS AUTOMATION
Model-Driven
Component-based Engineering
Software Engineering
Structured
Programming Object-Oriented Aspect-Oriented
Programming Programming
Assembly
Raising the abstraction Languages
level in Software Development
13 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
14. Agenda
Motivation
(Meta)Modeling
MDA
Putting MDE to work
Conclusion
14 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
15. Modeling
What’s in a model?
• What is a model?
– A model is a simplification of a system
built with an intended goal in mind.
– A model is a description of a system
written in a well-defined language
It should be able to answer questions in place of the actual system
It allows us to use something that is simpler, safer or cheaper than
reality instead of reality for some purpose.
Thus, it allows us to deal with the world in a simplified manner, avoiding
the complexity, danger and irreversibility of reality
A model represents reality for the given purpose; the model is an
abstraction of reality in the sense that it cannot represent all aspects of
reality
15 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
16. Modeling
What’s in a model?
• A model is the simplified image of a system
– MDE is recent but the idea of modeling is old
System repOf Model
– Plato (427-347 before JC), in Timeus compares
vertebras to door hinges (74a) or blood vessels to
irrigation channels
16 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
17. Modelling
How are models understood, interpreted, defined … ??
Every map has a legend
(implicit or explicit)
We cannot “get” the
map without its legend
The legend is the
metamodel
17 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
18. Modelling
How are models understood, interpreted, defined … ??
Every map has a legend
(implicit or explicit)
A model has no meaning when
separated from its metamodel,
We cannot “get” the
that acts asitsthe filter for the
map without legend
reality to be modelled
The legend is the
metamodel
18 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
19. Modelling
Metamodels act as filters for reality
A (very simplistic )
metamodel
for modelling Meetings
19 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
20. Modelling
Metamodels act as filters for reality
20 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
21. Modelling
The OMG modelling stack (abstract)
A metamodel is the model of a modelling
language: it makes statements about what
can be expressed in the valid models of a
certain modelling language.
Metamodel
c2 Terminology
c2
Assertions
Model
(Terminal Model)
21 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
22. Modelling
The OMG modelling stack (abstract)
c2
Metamodel
c2
Metamodel
Being a model, a
c2 metamodel has to
conform to its
c2 corresponding
Model metamodel
(Terminal Model)
22 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
23. Modelling
The OMG modelling stack (abstract)
c2
c2
Metamodel
Metametamodel
c2
Metamodel
The metamodel
might be expressed
c2
using the same
c2
modelling language
Model that it defines.
(Terminal Model) Then it’s called
metametamodel
23 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
24. Modelling
Don't confuse the model and the system
• Principle of limited substitutability.
– A model M is said to be a representation of a system S for a given set of questions Q
if, for each question of this set Q, the model M will provide exactly the same answer
that the system S would have provided in answering the same question.
e.g. the globe is a model of the
earth …. What is the temperature at the
bottom if I dig a 100 km deep hole at
the surface of the earth ?
repOf
… allowing to ask
certain questions …
Could I travel from Paris to New York
without using a boat or a plane? … but not others …
24 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
25. Modelling
Aspects of a system represented by models
Ma Mb A given system may
M1 Mc have plenty of
different models
Each model
isRepresentedBy
represents a given
aspect of the system
M0
S
25 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
26. Modelling
Different Models ↔ Different Languages
Plumber's Electrician's
view view
Architect's
view
Decorator's
Carpenter's view
view
Phone Installer's
view
26 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
27. Modelling
Domain Specific Languages (DSLs)
• Domain Specific Languages (DSLs) are
SELECT soh.[SalesOrderID]
languages tailored to a specific ,soh.[OrderDate]
,soh.[ShipDate]
application domain ,sod.[ProductID]
,sod.[OrderQty]
,sod.[UnitPrice]
– They offer substantial gains in expressiveness ,soh.[CustomerID]
FROM [Sales].[SalesOrderHeader] AS soh
and ease of use compared with general- JOIN [Sales].[SalesOrderDetail] AS sod
ON soh.[SalesOrderID] =
purpose programming languages in their sod.[SalesOrderID]
WHERE soh.[CustomerID] = 29559;
domain of application
– Higher-level abstraction than general
purpose languages
– Closer to the problem domain than
to the implementation domain
– Closer to domain experts
Metamodels define (partially) Domain Specific Languages (DSLs)
27 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
28. Modelling
Abstract syntax VS Concrete Syntax
Speaker(Mary)
Attendant(John)
Attendant(Peter)
Chair(c1)
Chair(c2)
Same Model Same Abstractions sat_on(John, c1)
Different notations Different syntaxes sat_on(Peter, c2)
28 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
29. Modelling
Abstract Syntax VS Concrete Syntax
Abstract Syntax
• There are two types of objects: Furniture and
Person
• In turn, each Furniture object could be a Chair or a
Desk and each Person an Attendant or a Speaker
• Each Person can be sat on one (and only one) piece
of Furniture
Concrete Syntax
– A box represents each Furniture or Person object
– The name of the object is included into an inner box
– Each occurrence of the relationship between
Furniture and Person objects is represented by an
arrow pointing to the Person object
29 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
30. Modelling
Abstract Syntax VS Concrete Syntax
Abstract Syntax
• There are two types of objects: Furniture and
Person
• In turn, each Furniture object could be a Chair or a
Desk and each Person an Attendant or a Speaker
• Each Person can be sat on one (and only one) piece
of Furniture
(Another) Concrete Syntax Speaker(Mary)
– Each object is represented by the reserved word Attendant(John)
that designates the type of the object plus the name Attendant(Peter)
of the object between brackets
Chair(c1)
– Each occurrence of the sat_on relationship is
represented by the reserved work sat_on plus the
Chair(c2)
name of the objects between brackets and sat_on(John, c1)
separated by commas sat_on(John, c2)
30 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
31. Agenda
Motivation
(Meta)Modeling
MDA
Putting MDE to work
Conclusion
31 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
32. MDA
A way of doing MDE
Sometimes MDA is referred to as
“MDE with standards”
Role of models MDE principles Automation
Standards to formalize Categorization of
MDE principles Abstraction Levels
QVT
OCL
SPEM
KDM
…
32 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
33. MDA
Categorization of Abstraction Levels: CIM
CIM •Computer Independent Model
• System requirements are modelled by Computer PIM •Platform Independent Model
PSM
Independent Models (CIMs) CODE
•Platform Specific Model
•Running system
– The CIM model is a view of the business processes
– … ellaborated by domain experts
– … is not always mandatory, it depends on the specific domain
addressed
Requirements Model
(use case and activity diagrams)
• … serve as a bridge between domain experts
and business analysts
33 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011
34. MDA
Categorization of Abstraction Levels: PIM
CIM •Computer Independent Model
• The PIM models the system without considering PIM •Platform Independent Model
PSM
specific platform technological details CODE
•Platform Specific Model
•Running system
– … allows the mapping to any technological platform
– … think of a neutral virtual machine where each operation will be later implemented
in the targetted platform
– … is always mandatory and may result into one or more PSMs
CIM
Huge gap between CIM
and PIM levels
Requirements Model ↓
(use case and activity diagrams) Traces at best
PIM <<Interface>>
PaymentFe
addPayment()
cancelPayment()
getPayments()
getPaymentActivity()
updatePayment()
<<Interface>>
PaymentFeExtended
addPaymentNoteExtended()
completePaymentExtended()
failPaymentExtended()
getPaymentsExtended()
pendPaymentExtended()
<<Interface>>
PaymentUtility
prepare()
getRouting()
checkForDuplicate()
: Consumer
1. Create payment
: ConsumerFrontEnd
1.1. Enter payment
: XmlConnector : PaymentService
Sequence Diagram: InteliWorks
Consumer: Payment Realizations /
Consumer: Payment - Enter
: FinancialTransactionService
resubmitPaymentExtended() 1.2. Display confirmation CreationData
FinancialTransactionBase
reversePaymentExtended() +creationData
1
<<Interface>> <<Interface>> Sequence Diagram: InteliWorks
PaymentEvent 2. Ok Consumer: Financial Transaction
Payment Realizations / Consumer: Financial FinancialTransactionConsumerData
+displayStatus DisplayStatus
processPayments() 2.1. addPaymentRq
handlePayeeChange() Transaction - Add 1 1
2.1.1. addPayment( )
2.1.1.1. addFinancialTransaction( )
FinancialTransactionData +processingData ProcessingData
2.1.1.1.1. financialTransaction 1 1
Notification FinancialTransactionCommon 0..1
(from eMessenger) PaymentService (from Financial Transaction Service)
+status 1
2.1.1.2. payment <<enumeration>>
FinancialTransactionTypeCode FinancialTransaction FinancialTransactionExtended ProcessingStatus
PAYMENT
FUNDS_TRANSFER
2.1.2. addPaymentRs 0..1 0..1 0..1 +status 1
FinancialTransactionUtility 1
+transactionType +previousStep
SchedulingEvent (from Financial Transaction Service)
0..1
1 +specification * +note *
(from Scheduler)
{ordered}
+amount
CurrencyAmount FinancialTransactionSpecification Note ProcessingStep
3. Close view Sequence Diagram: InteliWorks 1 0..1
3.1. View payments Consumer: Payment Realizations /
FinancialTransaction Consumer: Payment - View Payments
(from Financial Transaction Service)
PayeeUtility
AccountUtility
OperationalDirectory
(from Operational Directory Service)
PaymentRead FinancialTransactionRead
FinancialTransactionWrite
Navigation Maps User Interface Conceptual Data Model
(Class diagrams + Activity diagrams) (Sequence diagrams) (E/R diagrams)
34 Model-Driven Engineering: a first glance at a ¿new? way of conceiving software development @Santander ~ 21 July, 2011