Model-Driven Software Development
Total Page:16
File Type:pdf, Size:1020Kb
ModelModel--DrivenDriven SoftwareSoftware Development:Development: WhatWhat itit cancan andand cannotcannot dodo JonJon WhittleWhittle AssociateAssociate ProfessorProfessor InformationInformation && SoftwareSoftware EngineeringEngineering GeorgeGeorge MasonMason UniversityUniversity http://ise.gmu.edu/~jwhittle OutlineOutline Introduction to Modeling Introduction to OMG’s Model-driven Architecture (MDA): – What is MDA? – Example – MDA supporting technologies: metamodeling, transformations, executable UML – Tool support Introduction to Microsoft’s Software Factories – Domain Modeling – Domain-Specific Languages – The Microsoft-OMG Debate Model-Driven Development (MDD) in the future 2 SystemSystem ModelingModeling WhatWhat isis aa (system)(system) model?model? – “A simplified description of a complex entity or process” [web dictionary] – “A representation of a part of the function, structure and/or behavior of a system” [ORM01] – “A description of (part of) a system written in a well- defined language” [KWB03] KeyKey point:point: – Models are abstractions – Entire history of software engineering has been one of raising levels of abstraction (01s → assembly language → 3GLs → OO → CBD → patterns → middleware → declarative description) 3 WhyWhy Model?Model? ModelsModels cancan bebe usedused in:in: – System development – System analysis – System testing/validation/simulation EachEach requiresrequires abstractionabstraction ofof complexitycomplexity WhyWhy notnot model?model? – Large(r) effort required – Synchronization – Delayed return – Requires specialized skills 4 ModelModel TaxonomyTaxonomy Model Business System Model Model Logical Physical Model Model Requirements Computational Model Model Platform Platform Independent Specific From FRA03 Model Model 5 Internal reqmts: Cost/planning, schedule, Cf.Cf. 4+14+1 viewsviews Monitoring, reuse, portability, Etc. Layered view. OO decomposition Performance, Availability, Fault tolerance, Pipe/filter scalability Client/server etc. Driver, validator From [4+1] 6 AbstractionAbstraction inin UMLUML Use case model abstracts away: – Computation – Irrelevant or low-priority functionality – Non-functional requirements Analysis model abstracts away: – Decisions on “ilities”: performance and distribution requirements; optimizations etc. – Decisions on data structures – Booch/Rumbaugh/Jacobson: 1:5 ratio going from analysis to design – (for class diagrams): operations interface, “design attributes”, visibilities, navigability Design model abstracts away: – Physical deployment (nodes, processors etc.) – Use of Source files, libraries etc. 7 AbstractionAbstraction inin UMLUML (cont(cont’’d)d) SequenceSequence diagramsdiagrams abstractabstract to:to: – Inter-object (component, process) communications StateState machinesmachines abstractabstract to:to: – Intra-object behaviors – Without method implementations – Without middleware concerns – Abstract communication ClassClass diagramsdiagrams abstractabstract to:to: – Structure, no behavior 8 UML2.0UML2.0 WhatWhat’’ss new:new: –– SupportSupport forfor componentscomponents –– MuchMuch improvedimproved interactioninteraction diagramsdiagrams MSC-like constructs Interaction overview diagrams –– MetamodelMetamodel forfor OCL2.0OCL2.0 –– MoreMore consistentconsistent UMLUML metamodelmetamodel –– TighterTighter relationshiprelationship betweenbetween MOFMOF andand UMLUML 9 ModelingModeling softwaresoftware systems:systems: –– WhatWhat isis thethe future?future? Sketch Blueprint Programming language Rhapsody, RoseRealTime, Simulink, Rational XDE, OptimalJ DS1: 10 230,000LOC 10 OutlineOutline Introduction to Modeling Introduction to OMG’s Model-driven Architecture (MDA): – What is MDA? – Example – MDA supporting technologies: metamodeling, transformations, executable UML – Tool support Introduction to Microsoft’s Software Factories – Domain Modeling – Domain-Specific Languages – The Microsoft-OMG Debate Model-Driven Development (MDD) in the future 11 MDAMDA DefinitionDefinition ModelModel DrivenDriven Architecture:Architecture: – Recent initiative from the Object Management Group (OMG) making models and transformations between models first-class elements – Builds on UML and OCL (Object Constraint Language) – More info: MDA Explained: The Model Driven Architecture, Practice & Promise, Anneke Kleppe, Jos Warmer & Wim Bast Model Driven Architecture. Applying MDA to Enterprise Computing. David S. Frankel. OMG Press 2003. http://www.omg.org 12 WhyWhy MDA?MDA? ProductivityProductivity problem:problem: – Time/budget-crunch means early lifecycle artifacts are not maintained Requirements documents, design documents etc. (UML or other) become obsolete – Why spend so much time on high-level specs anyway? Cf. eXtreme programming, agile modeling PortabilityPortability problem:problem: – Technology is growing fast (Java, XML, UML, J2EE, .NET, JSP, SOAP, Flash etc.) – How does software keep up? 13 WhyWhy MDA?MDA? InteroperabilityInteroperability problem:problem: –– SystemsSystems needneed toto interoperateinteroperate withwith otherother systemssystems Cf. web-based systems, component-based systems Maintenance/DocumentationMaintenance/Documentation problem:problem: –– DespiteDespite bestbest--practicepractice advice,advice, mostmost softwaresoftware projectsprojects dodo notnot adequatelyadequately model/documentmodel/document software,software, letlet alonealone maintainmaintain itit 14 MDAMDA DevelopmentDevelopment LifecycleLifecycle MDA lifecycle similar to requirements traditional lifecycle, but: Mostly text MDA – Emphasis on creation of Process formal models (i.e., models analysis that can be understood by computer) PIM 2 types of models: design – Platform-independent model PSM – Platform-specific model 3 types of transformations: coding – PIM-to-PIM – PIM-to-PSM Code – PSM-to-code testing Importance of transformation automation Code deployment 15 Taken from [KWB03] MDAMDA BenefitsBenefits Productivity: – Work is done mainly at the PIM level – PIM-to-code transformation is automated – Caveat: need to define transformations, but they can be reused (hopefully) Portability: – PIMs are implementation-independent – Incorporate new technologies by defining new (reusable) transformations Interoperability: – MDA tools should generate bridges Maintenance/Documentation: – Changes to the PIM can be filtered down to PSM/code by re- applying transformations 16 MDAMDA requirementsrequirements ConsistentConsistent && preciseprecise highhigh--levellevel modelsmodels Standard,Standard, wellwell--defineddefined language(slanguage(s)) toto writewrite highhigh--levellevel modelsmodels –– OMGOMG StandardsStandards Modeling – UML; Metamodeling – MOF; Action semantics; Model interchange – XMI; Human- readable textual notation – HUTN; … Transformations:Transformations: –– DefinitionsDefinitions –– TransformationTransformation languagelanguage (formal)(formal) QVTQVT –– TransformationTransformation toolstools 17 ModelsModels inin MDAMDA MDAMDA models:models: – Must be precise (enough) – May be software or business models – May be written in UML or some other language – May be code (code is a model) Caveats:Caveats: – How precise is UML? – Is there a clear distinction between a PIM and a PSM? 18 WhatWhat isis aa transformation?transformation? Transformation consists of: – A set of transformation rules Unambiguous specifications of the way that (part of) one model can be used to create (part of) another model Definitions: – A transformation is the automatic generation of a target model from a source model, according to a transformation definition – A transformation definition is a set of transformation rules that together describe how a model in the source language can be transformed into a model in the target language – A transformation rule is a description of how one or more constructs in the source language can be transformed into one or more constructs in the target language Preferred characteristics: – A transformation should be semantics-preserving Note: transformations may be between different languages. In particular, between different dialects of UML (UML profiles) 19 Taken from [KWB03] SimpleSimple Example:Example: public/privatepublic/private attributesattributes Transformation: UML PIM to UML/Java PSM Purpose: transform public attributes into get/set operations Customer Customer title : String title : String name : String name : String dateOfBirth : Date dateOfBirth : Date getTitle() : String setTitle(title : String) getName() : String setName(name : String) getDateOfBirth() : Date setDateOfBirth(d : Date) 20 Taken from [KWB03] TransformationTransformation DefinitionDefinition ForFor eacheach classclass namednamed classNameclassName,, transformtransform intointo aa classclass namednamed classNameclassName forfor eacheach publicpublic attributeattribute attributeNameattributeName :: TypeType ofof classclass classNameclassName,, createcreate attributes/operationsattributes/operations forfor classNameclassName inin thethe PSMPSM asas follows:follows: – Private attribute attributeName : Type – Public operation getAttributeName() : Type – Public operation setAttributeName(att : Type) Exercise:Exercise: definedefine aa JavaJava PSMPSM--toto--codecode transformationtransformation thatthat generatesgenerates JavaJava codecode forfor JavaJava PSMsPSMs 21 Taken from [KWB03] SimpleSimple example:example: associationsassociations Customer Order title : String +customers +orders number : Integer name : String date : Date dateOfBirth : Date 1 * +items 1..* Item number : String name : String