MDSE: Model-Driven Software Engineering

download MDSE: Model-Driven Software Engineering

If you can't read please download the document

description

MDSE: Model-Driven Software Engineering. Dr. Tom Verhoeff. NMA Summer Session 2012, Nida , Lithuania. My Background. Studied Applied Mathematics at TU/e PhD: A Theory of Delay-Insensitive Systems Assistant Professor in Computer Science Exchange Researcher at ASML (1 day / week) - PowerPoint PPT Presentation

Transcript of MDSE: Model-Driven Software Engineering

Dia 0

MDSE:Model-DrivenSoftware EngineeringDr. Tom VerhoeffNMA Summer Session 2012, Nida, LithuaniaMy BackgroundStudied Applied Mathematics at TU/ePhD: A Theory of Delay-Insensitive SystemsAssistant Professor in Computer ScienceExchange Researcher at ASML (1 day / week)Research: Software Engineering & TechnologyOn the side:ACM ICPC (super-regional director Europe)IOI (chair Scientific Committee; host in 1995)IMO (host in 2011)Dutch OI, MO, Beaver, Kangaroo (NMA Summer Sessions 2006, 2008, 2010; Math Art)

/ Mathematics & Computer SciencePhD: Silicon compiler for asynchronous (clockless) digital circuits; power saving, flat EM spectrumEngineer: also worry about cost; how to calculate cost of software: (1) development cost + profit margin; (2) as percentage of what customer saves1Your BackgroundBenas JacikasDina AlyteJulijonas KikutisKarolis GreblikasKarolis VyciusLukas AliuskeviciusLukas DapkusTomas SiurnaValentinas Janeiko

/ Mathematics & Computer Science

GoalsBasic understanding of MDSEMain concepts and terminologyWhat is involved; incl. context, bigger pictureWhat to do with it; how it works in principleWhy it is interesting

Hands-on experience in small case studyEclipse IDEEclipse Modeling Framework/ Mathematics & Computer ScienceHistory of automation and programmingNon-programmable automata

(Re)configurable automata

Programmable automata:Machine languageAssembly languageGeneral-purpose higher-level programming languagesSyntax, semanticsGrammars, parsers, code generators/interpreters/ Mathematics & Computer SciencePlanetarium, clock, Jaquard loom, cypto machinesAssembler: pretty simple 1-to-1 translation4History of Design ParadigmsFunctional decompositionHarder to maintain / accommodate changesObject-orientedFocus on data as longer-term stable core of systemData base + business logic + presentation layerPut data in persistent storage, outside running programLimited structure, all data together

Domain-Specific Language (DSL)Designed by CS experts for use by non-CS expertsNot (necessarily) universal (Turing complete)

/ Mathematics & Computer Science5Domain-Specific Language (DSL) RealizationsVia libraryEmbedded in host languageAs extension of existing languageIndependent, external

/ Mathematics & Computer ScienceHistory of Software EngineeringConcerns Way of Working, the development processPre-SE:Code-and-FixSE:Waterfall process (traditional)Requirements Engineering (RE)Architectural Design (AD)Detailed Design and Test (DD)Operation and Maintenance (OM)Other life cycle processesUnified Process (UP), Agile (e.g. XP)MDSE (Model-Driven Software Engineering)/ Mathematics & Computer ScienceMDSEStarts with Domain Engineering (DE), before RE

1. Domain specification, domain analysis

2. Requirements specification, requirements analysis

3. Design, implementation, maintenance:Define model(s)Generate code (or whatever is needed)Evolve model(s), not codeRegenerate/update code

/ Mathematics & Computer ScienceExamples of DomainsRailway, Airlines, transportation-in-generalWarehousingFinancialMilitary organizationBuilding constructionCivil engineeringAutomotiveTelecommunicationMedical

/ Mathematics & Computer ScienceUses of ModelsGenerate codeVisualizeAnimateSimulateAnalyzeVerify (formally), e.g. using Model Checkers/ Mathematics & Computer ScienceAdvantages of MDSEDesign at higher level of abstractionCloser to that of (usually non-CS) domain expertsEasier to involve (non-CS) domain expertsHigher productivityHigher quality (fewer defects)Models also serve as (up-to-date) documentationEasier to evolve/maintain/ Mathematics & Computer ScienceFormal Language Concepts (Grammar-ware)(Formal) Language:Set of "allowed" texts (strings) over a given alphabet,Each text is a sequential (list) data structure

Grammar: formalism to define a formal languageThis only concerns syntaxContext-free grammarGeneral" (context sensitive and more) grammar, attribute grammar

Informal "language": any "mechanism"/formalism to express/define "something"

/ Mathematics & Computer ScienceIn practice, there is also a lexical level distinguished to define the tokens of the alphabet; tokens are built from (lower-level) characters12Example Grammar for Simple ExpressionsExpr Expr + TermExpr TermTerm Term * PrimaryTerm PrimaryPrimary ( Expr )Primary NatNat DigitNat Nat DigitDigit 0 | 1 | 2 | | 9/ Mathematics & Computer ScienceExample of Parsing(1 + 2) (3 + 4)(1 + 2) * 3/ Mathematics & Computer ScienceGrammar-ware Tool supportFormal language to define grammarsSpecialized editor to edit grammar definitionsTool to analyze grammar definitionsTool to generate parser from grammar definitionParser takes text as inputParser decides whether text belongs to the languageIf yes, parser produces an abstract syntax tree for textTool to generate a language-aware editor for language defined by a grammar/ Mathematics & Computer ScienceSemanticsSemantics (of a language):Defines a meaning for each text in a language

Cf. programming language:SyntaxStaticDefines valid program textsSemanticsDynamicDefines behavior under execution/ Mathematics & Computer Science[[Meta-]Meta-]modelMeta-meta-model:formalism ("language") to define meta-models

Meta-model:formalism ("language") to define a coherent collection of modelscf. notion of data type, as a set of values + corresponding operations

Model:information/data "bundle" conforming to a specific meta-modelcf. notion of value of a data type

/ Mathematics & Computer ScienceComparison of Concepts and Levels/ Mathematics & Computer ScienceLevel M3In (a) Level M2you express a Level M1defining a set ofProgramming LanguageData Type Definition

Values of Data Type

JavaClass DefinitionObjects, instances of classSQLData Base SchemaData Base ContentsLanguage to define grammars

Grammar defining a language

Texts in language defined by grammarMeta-meta-modelMeta-modelModelsDomain-Specific (Modeling) LanguageAbstract Syntax = meta-modelConcrete Syntax = grammar for textual renderingOptional, not requiredSemantics:values, structural, data structuremultiplicity, order, relationshipsbindings (identifier resolution, scope, type)constraints, invariantsexecution:expressions and their evaluationstate, state transition/ Mathematics & Computer ScienceModel TransformationsText to model: T2M

Model to text: M2T

Model to model: M2M/ Mathematics & Computer ScienceText to Model (T2M)Involves grammar for allowed texts, and parsing

XtextAutomatic generation of meta-model from grammar

EMFTextGood to create one, or more, grammars for existing meta-model

Gtext (TU/e, under development)Fewer restrictions on grammar/ Mathematics & Computer ScienceModel to Text (M2T)Often used for source code generation from models

Xpand , Xtend(2)Uses a template language

EMFText does this as wellPretty printing (inverse of parsing)/ Mathematics & Computer ScienceModel to Model (M2M)Java, ...Hard work, lots of codeCan use your favorite language

Xtend(1), Xtend(2)

ATLDeclarative

QVT OperationalImperative/ Mathematics & Computer ScienceDefining Meta-Models in EcoreEcore is (implements) a Meta-Meta-ModelIngredients of Ecore meta-model definitions:EPackageActs as container to collect other itemsEClass: Models a concept, havingpropertiesEAttribute, EReference, EAnnotationEData TypeEEnumEAnnotation: comments, constraints, meta-info/ Mathematics & Computer ScienceEdit Ecore Meta-ModelsSample Ecore Model EditorShows editable tree view of the meta-modelVisible structure is complete determined by meta-model

Ecore Diagram EditingShows editable graphical view of the meta-modelLayout of graphics can (must) also be edited

OCLinEcore (Ecore) EditorShows editable textual view of the meta-model

/ Mathematics & Computer ScienceModel to Text TransformationTraverse the model and generate text

Output containsFixed elementsTransformed elements from model

Transformation usually preceded by checking phase

Xpand: (yet another) domain-specific language/ Mathematics & Computer ScienceModel to Model TransformationWhen a transformation to text becomes complicated, it can be split:One ore more M2M transformationsOne M2T transformation

QVT (Query/View/Transformation) OperationalYet another domain-specific languageImperative language based on OCLDemonstration: flip a Shot Puzzle/ Mathematics & Computer ScienceM2M Transformation TT : MMAi --> MMBi

T takes one, or more, models MAi as inputModels MAi are from specified meta-models MMAi

T produces one, or more, model MBi as outputModels MBi are from specified meta-models MMBi

T traverses the inputs MAi constructing outputs MBi/ Mathematics & Computer SciencePrograms are Models TooPrograms are (or: can be considered) models in a general-purpose meta-model (programming language)Generate programsAs text via M2T transformationAs model via M2M transformation to meta-model of the programming languageBypasses the textual format and its parsing/ Mathematics & Computer ScienceDesign of Modeling ToolsTools for MDSE are designed using MDSEBootstrappingInvolves (many) Domain-Specific Languages (DSL)There is a DSL for defining DSLs/ Mathematics & Computer ScienceCurrent State of MDSEMany non-CS domain experts do not know MDSEMDSE tools are still immature (under development)Buggy, incompleteFrequently changingComplex to use (many steps needed, limited graphics)Incomprehensible trickery involvedDumb editors (no refactoring: e.g. rename attribute)MDSE concepts + theory are still evolving(Meta-)model limitations (tree as skeleton, modularity)(Meta-)model comparison, and versioningMeta-model/model co-evolution(Meta-)model semantics (static + dynamic)/ Mathematics & Computer ScienceMy Wish ListOne simple programming language, in which youDefine data types and meta-models alikeManipulate data values and models alikeInput / OutputConstruct, InspectTransform/ Mathematics & Computer ScienceConclusionMDSE is promisingthe way to gountil a better approach is discovered / invented

MDSE is young (work-in-progress)

You have played with bleeding edge technology/ Mathematics & Computer Science