A Bridge over Troubled Water: Synergies between Model Transformations and Software Maintenance Techniques

  • Published on
    06-May-2015

  • View
    398

  • Download
    0

Embed Size (px)

DESCRIPTION

Invited talk at CSMR 2012, 16th European Conference on Software Maintenance and Reengineering

Transcript

<ul><li>1.A Bridge over Troubled Water:Synergies betweenModel Transformation andSoftware Maintenance TechniquesDniel Varr Budapest University of Technology and EconomicsCSMR 2012Szeged, Hungary, March 29th, 2012Budapest University of Technology and EconomicsDepartment of Measurement and Information Systems</li></ul><p>2. Song writing methods of Simon and Garfunkel 3. Paul Simons technique #1 Bridge Over Troubled Water When youre weary Feeling small When tears are in your eyes I will dry them all Im on your side When times get rough And friends just cant be found Like a bridge over troubled water I will lay me down Like a bridge over troubled water I will lay me down1. Create music first 2. Write lyrics accordingly3 4. Paul Simons technique #2The BoxerI am just a poor boyThough my storys seldom toldI have squandered my resistanceFor a pocket full of mumbles such are promisesAll lies and jestsStill a man hears what he wants to hearAnd disregards the restWhen I left my home and my familyI was no more than a boyIn the company of strangersIn the quiet of the railway station running scaredLaying low, seeking out the poorer quartersWhere the ragged people goLooking for the places only they would know1. Write lyrics first2. Compose music accordingly 4 5. A Combined TechniqueScarborough Fair (Folk Song) The Side of a Hill (P. Simon)Tell her to find me an acre of land, On the side of a hill, a little cloud weepsParsley, sage, rosemary and thyme; And waters the grave with its silent tearsBetween the salt water and the sea strand, While a soldier cleans and polishes a gunThen shell be a true love of mine.Canticle (rearranged by A. Garfunkel)On the side of a hill a sprinkling of leavesWashes the grave with silvery tearsA soldier cleans and polishes a gun 5 6. Naming These TechniquesBridge Over Troubled WaterWhen youre wearyFeeling small Music Driven Song DevelopmentWhen tears are in your eyesI will dry them all(MDSD)Im on your sideWhen times get roughAnd friends just cant be foundLike a bridge over troubled waterI will lay me downLike a bridge over troubled waterI will lay me down1. Create music first 2. Write lyrics accordinglyThe BoxerI am just a poor boyThough my storys seldom toldI have squandered my resistanceFor a pocket full of mumbles such are promises Lyrics Driven Song Development All lies and jestsStill a man hears what he wants to hearAnd disregards the restWhen I left my home and my familyI was no more than a boyIn the company of strangersIn the quiet of the railway station running scaredLaying low, seeking out the poorer quartersWhere the ragged people goLooking for the places only they would know1. Write lyrics first2. Compose music accordingly6 7. Applying the Principle to Software Systems Model Code Bridge Over Troubled Water When youre weary Feeling small When tears are in your eyes I will dry them all Im on your side When times get rough And friends just cant be found Like a bridge over troubled water I will lay me down Like a bridge over troubled water I will lay me down MusicLyrics 7 8. Some Well-known TransformationsCode generation Generative programming ModelCode Model Re-engineering Query Query Program comprehensionModelRefactoringRefactoring8 9. A Classification of TransformationsM2T: Model-to-TextModelCode T2M:Text-to- ModelModel Transformations:Topic of this talkM2M: Model-to-ModelT2T: Text-to-Text 9 10. Model-Driven Software DevelopmentM2T: Model-to-TextModel CodeConferences:M2M: Model-to-Model MODELS, ECMFA, ICMT10 11. Software Maintenance and Re-engineering Model CodeT2M: Text-to-ModelConferences:CSMR, ICSM T2T: Text-to-Text 11 12. Objectives: Build More Bridges for Roundtrips M2T: Model-to-Text ModelCodeT2M: Text-to-Model M2M: Model-to-ModelT2T: Text-to-Text 12 13. Talk OverviewOverview &amp;Applications of MTBasicsApplications from own practiceA tool (MTSMR) to build your SMR tool increm. model queriesTargets (SMRMT) future research collaboration13 14. Model Transformations inModel Driven Software Development 15. Development Process for Critical SystemsUnique Development Process(Traditional V-Model)Critical Systems Design requires a certification process to develop justified evidence that the system is free of flawsSoftware Tool Qualification obtain certification credit for a software toolDO-178B used in critical system designIEC 61508Innovative Tool Better SystemQualified Tool Certified Output 16. Model-Driven Engineering of Critical Systems Traditional V-ModelModel-Driven EngineeringMain ideas of MDE DO-178B/C: Software Considerations in Airborne Systems and early validation of system modelsEquipment Certification (RTCA, EUROCAE) Steven P. Miller: Certification Issues in Model Based Development automatic source code generation(Rockwell Collins) quality++ tools ++ development cost-- 17. Models and Transformations in Critical SystemsHorizontal Model TransformationsModel generation System Design System V&amp;V ModelModel Refine Back-AnnotationUse Design Model generationFormalVertical Model Transformations rules ArchitectureArchitecture methods Design ModelV&amp;V Model Refine Back-Annotation UseDesignModel generationFormalrules ComponentComponentmethods Design ModelV&amp;V ModelBack-Annotation Design rules CodeModel Transformations Test systematic foundation of GenerationGeneration knowledge transfer: Related projectstheoretical resultstools Design + V&amp;V Artifacts CESAR, SAVI, bridge / integrate(Source code, Glue code, HIDE, DECOS, DIANA,Config. Tables, Test Cases,existing languages&amp;tools MOGENTES, CERTIMOT,Monitors, Fault Trees, etc.) GENESYS, SENSORIA 18. Modeling Languages andModel Transformations 19. Overview: Foundations of Model Transformations Horizontal Model Transformations Model generationSystem DesignSystem V&amp;VModel ModelBack-Annotation RefineUse Design Model generation Formal rules ArchitectureVertical Model TransformationsArchitecture V&amp;V methodsDesign ModelModel Refine Back-Annotation UseDesignModel generation FormalrulesComponent Component methods Design V&amp;V Model ModelBack-AnnotationDesignrulesCode Test GenerationGeneration Foundations ofmodel transformations Design + V&amp;V Artifacts (Source code, Glue code,Config. Tables, Test Cases, Monitors,Fault Trees, etc.) 20. Domain Specific Modeling LanguagesConcrete syntax Abstract syntaxWell-formedness(Graphical/Textual)(Metamodel) constraints Behavioural semantics,Simulation Mapping Code generation Domain-Specific Modeling Languages (DSML):Concrete syntax: Foundations of many modern tool Source Code View How the designer sees it (design, analysis, V&amp;V) (Documentation, Graphical/textual/both Domains: avionics, automotive, Configuration file) business modeling 21. Domain Specific Modeling LanguagesConcrete syntaxAbstract syntax Well-formedness(Graphical/Textual) (Metamodel)constraints Behavioural semantics,SimulationMappingCode generationAbstract syntax: Source CodeView Internal graph representation(Documentation, Defined by a metamodel Configuration file) 22. Domain Specific Modeling LanguagesConcrete syntaxAbstract syntax Well-formedness(Graphical/Textual) (Metamodel)constraints Behavioural semantics,Simulation Mapping Code generationWell-formedness constraints: Source Code View REQs for valid static models (Documentation, Captured declaratively (OCL) Configuration file) 23. Domain Specific Modeling LanguagesConcrete syntaxAbstract syntax Well-formedness(Graphical/Textual) (Metamodel)constraints Behavioural semantics,Simulation Mapping Code generationBehavioural Semantics: Source Code View For dynamic MLs only (Documentation,(statecharts, business processes)Configuration file) Enables model simulation/execution 24. Domain Specific Modeling LanguagesConcrete syntax Abstract syntax Well-formedness(Graphical/Textual)(Metamodel)constraintsBehavioural semantics, SimulationMapping CodegenerationView/Compile/Map: Source CodeView View / code generation(Documentation, Model transformation exercise Configuration file) 25. Model Transformation Overview: MetamodelsMetamodel: Precise spec ofa modeling language Modeling toolSourceTarget MT rule metamodel metamodel Source Target modelmodel 26. Model Transformation Overview: ModelsEclipse Modeling Framework (EMF): De facto modeling standard forEclipse based modeling tools Design metamodel auto-generate toolModelinginterface, implementation, tree editor Examples:Source MT rule TargetUML, AADL, SysML, metamodel BPMN, AUTOSARmetamodel&gt;30 in a single IBM toolSource Model: DescriptionTargetmodelof a concrete systemmodel a1:PTArca2:TPArc t1:Transitionp1:Placetk:Tokenp2:Placet2:Transition a4:TPArca3:PTArc 27. Model Transformation Overview: Rules Model Transformation: How to generate a target equivalent of an arbitrary source model Modeling toolSourceTargetMT rule metamodel metamodel Source Target modelmodel LHS RHS a1:inarc a2:outarc a1:inarc a2:outarc PlaceTran. Place PlaceTran.Planttn1:tokens tkn2:tokens TokenToken 28. Model Transformation Overview: Rule Execution Eclipse FrameworkModel Transformation Tool Modeling tool Source Target MT rulemetamodelmetamodelSourceTarget MT enginemodel model Transformation engine: Support for querying and manipulating large models ATL VIATRA2: http://www.eclipse.org/gmt/VIATRA2/ QVT 29. Model Transformation by Graph Transfromation Eclipse FrameworkModel Transformation ToolModeling toolSource TargetMT rule metamodelmetamodel SourceTargetMT engine model modelquery/match update LHSRHS a1:inarc a2:outarca1:inarc a2:outarc PlaceTran. PlacePlaceTran.Planttn1:tokenstkn2:tokens Token Token 30. Overview of Model Transformations Eclipse Framework Model Transformation Tool Modeling toolSource TargetMT rulemetamodel metamodelNative source models:Native target models: EMF EMF XML Sourcedocuments App source code Target Databasesmodel MT engine XML deployment descript. model Domain-specific models Databases UML Analysis toolsNative Native source model target model 3rd Party Tool 31. Standalone Model Transformations Plugins Eclipse FrameworkModel Transformation Tool Modeling toolSourceTargetMT rule metamodel metamodel SourceTarget MT engine model model Standalone transformation:Code generator Independent of transformation development environmentNativeNative Native source modelMT plugintarget model 3rd Party Tool D. Varr, A. Pataricza: Generic and Meta-Transformations for Model Transformation Engineering . UML 2004 32. Incremental Model Queries By EMF-IncQuery 33. Overview: Early Validation of Design Rules Horizontal Model Transformations Model generation System DesignSystem V&amp;V Model Model Back-AnnotationRefineUseDesign Model generation Formalrules Architecture Architecture V&amp;V methods Vertical Model Transformations DesignModel ModelRefine Back-AnnotationUse DesignModel generation Formal rulesComponent ComponentmethodsDesign V&amp;VModel Model Back-Annotation Design rules Code TestGenerationGenerationValidation of design rulesby incremental model queriesDesign + V&amp;V Artifacts(Source code, Glue code, Config. Tables, Test Cases, Monitors, Fault Trees, etc.) 34. Challenge: Early validation of design rulesSystemSignalGroup design rule (from AUTOSAR) o A SystemSignal and its group must be in the same IPdu AUTOSAR: o Challenge: find violations quicklyarchitecturemodels standardized SW in large o New difficulties of the automotive industry now supported by modern modeling tools reverse Design Rule/Well-formedness constraint:navigation each valid car architecture needs to respect designers are immediately notified if violated complex Challenge:manual &gt;500 design rules in AUTOSAR toolssolution &gt;1 million elements in AUTOSAR models models constantly evolve by designers 35. Capturing design rules as model queriesExample: SystemSignalGroup design rule (from AUTOSAR) A SystemSignal and its signal group must be in the same IPDU(Protocol Data Unit)Our approach Capture design rules as model queries Incremental re-validationOthers approaches: X. Blanc, A. Egyed, T. Mens,OCL, ModelQuery(A,B): tuples of model elements A, B satisfying the query condition enumerate 1 / all instances A,B can be input or output 36. Graph Patterns as Query Language Graph patterns as pattern mappedSignal(S,M,P) = {declarative query language SignalIPdu(P); o Attribute constraints signalToPduMapping(R3,P,M); ISignalToIPduMapping(M); o Local + global queries signal(R1,M,S); o Compositionality + ReusabililityISignal(S); o Arbitrary Recursion, Negation, } Transitive Closure pattern systemSignal(S,SS) = { o Syntax: DATALOG style ISignal(S); systemSignal(R2,S,SS); SystemSignal(SS);}pattern systemSignalGroup(P) = { find mappedSignal(S_Child,M_Child,P); find systemSignal(S_Child,SS_Child); systemSignal(R7,SS_Parent,SS_Child); find systemSignal(S_Parent,SS_Parent); neg find mappedSignal(S_Child,M_Child,P);} 37. Incremental Evaluation of Graph Queries Graph patterns as pattern mappedSignal(S,M,P) = {declarative query language SignalIPdu(P);o Attribute constraintssignalToPduMapping(R3,P,M); ISignalToIPduMapping(M);o Local + global queries signal(R1,M,S);o Compositionality + Reusabilility ISignal(S);o Arbitrary Recursion, Negation,}Transitive Closurepattern systemSignal(S,SS) = {o Syntax: DATALOG styleISignal(S); systemSignal(R2,S,SS); SystemSignal(SS); Evaluation: incremental} cache of matches (RETE)pattern systemSignalGroup(P) = { find mappedSignal(S_Child,M_Child,P); Cheap maintenance of cache find systemSignal(S_Child,SS_Child);(only memory overhead) systemSignal(R7,SS_Parent,SS_Child); Notify about relevant changes find systemSignal(S_Parent,SS_Parent); Enable reactions to complex neg find mappedSignal(S_Child,M_Child,P);structural events }G. Bergmann et al.: Incremental evaluation of model queries over EMF models. MODELS 2010. 38. Scalability of EMF-IncQueryEMF-IncQuery: available from Context of experiments:http://viatra.inf.mit.bme.hu/incquery Generated AUTOSAR models &gt; 1,5 million model elements #violations 30 tools reengineering (T. Horn)(from both communities) Solved by 7 MT tools parseSource code Model query 67 68. Design Patterns and Metrics vs. MT Design PatternsDesign patterns Metrics for MT by MTfor MTs Design pattern / Good design Quality assessmentsmell captured as apractices for MT for MTquery Karsai et al, van Amstel et al., Modifications as Iacob et. al,Vignana, Saeki,MT rules Lano et al., Kapova et al., Extensive literature Only since2009/2010 DesignMetrics Pattern Definition query query measureModelModel MT68 69. Refactoring vs. Model Transformations MT for refactoringMT o T. Mens, G. Taentzer,Model 1 Model 2 o L. Vidcs, R. Ferenc, M. GogollaSource Sourceo Van Eetvelde,Code 1 Code 2Janssens o J. Grey, o EMF-Refactor MT1MT2 Refactoring of MTas model as model o Ehrig et al. 2009 refactor69 70. Migration / Evolutionchange Model migrationMetamodelMetamodelo Metamodel v1 v2changes to newversion ModelModel Migrate modelinstancesupdateo Tools: COPE/Edapt,changeEPSILON FLOCK,MetamodelMetamodel(Herrmannsdrfer,Kolovos, Paige, v1 v2Levendovszky et al.) MT migration MT MTo Mendez et al.o Roser&amp;Bauerupdate 70 71. Slicing of Model Transformations Pr...</p>