XTEAM: Automated Synthesis of Domain-Specific Code Generators George Edwards [email protected] Introduction to the Center for Systems and Software Engineering
Dec 21, 2015
XTEAM: Automated Synthesis ofDomain-Specific Code
Generators
George [email protected]
Introduction to the Center for Systems and Software
Engineering
Brief Introduction to CSSE• Established in 1993 as CSE
– Merged in 2006 with SAE to form CSSE
• Focus on research and teaching– MSCS with emphasis in SE– Graduate Certificate in SAE– Two Certificate and Advanced Degree programs
• Objective is to solve scientific problems with industrial relevance
CSSE Affiliates• 22 industrial affiliates
– 8 from aerospace industry– 12 from other industries– 2 international
• 12 government affiliates– 6 government agencies
• incl. US Army TACOM and Research Labs
– 6 FFRDCs and consortia
• 7 academic affiliates– 5 universities– 2 research centers
• 3 visiting associates
Software Architecture Research
• Modeling• Analysis• Implementation• Deployment• Dynamic adaptation• Architectural styles• Software connectors• Architectural recovery
XTEAM Project Overview
• Processes, notations, tools, and designs that enable automated synthesis of end-to-end domain-specific toolsets for software architecture modeling, analysis, and code generation
• Example application areas:– Systems-of-systems and ultra-large-scale
systems– Safety- and mission-critical systems– Cloud and grid systems
Domain-Specific Languages (DSLs)
• Customized for a particular family of problems(the domain)
• Concise and intuitive– No missing or extra
features– Capture patterns– Enforce constraints– Use native symbols and
terms
• Can be modified, evolved, and composed
Model-Driven Engineering (MDE)• MDE leverages DSLs for architecture modeling
– Metamodels define DSL syntax (types, properties, views, and constraints)– Model interpreters define DSL semantics (analysis, code generation,
etc.)
• MDE platforms provide (some) tool support– Metamodel editor with built-in metamodeling language– Metamodel interpreter that configures a metaprogrammable model
editor
Metamodel Editor
Metamodel Editor
Metaprogrammable Model Editor
Metaprogrammable Model Editor
Model Execution
Environment (Semantic Domain)
MetamodelInterpreter
ModelInterpreter
Off-the-shelf
Auto generated
Built by engineer
Domain-Specific Model
Domain-Specific Model
Domain-Specific ModelMetamodel
Metamodeling Language
Domain-Specific Language
Executable Model
Executable Model
Executable Model
8
“The difficulty of building and maintaining a DSM solutionstems essentially from the complexity of the mapping between the concept instances expressed in the DSML and the code that has to be generated.”
A. L. Santos et al. Automating the Construction of Domain-Specific Modeling Languages for Object-Oriented Frameworks. Journal of Software and Systems, 2010.
Problems with MDE• Building and
maintaining code generators for DSLs is inherently difficult– High design complexity– Disproportionate
maintenance and evolution costs
– Hard to verify correctness– Redundant development
effort– Opaque semantics
embedded in source code
“There is a fundamental problemin keeping the model interpreters up to date with metamodel changes ... Current practice requires each model interpreter to be modified manually after each metamodel schema change. This can be a very time-consuming and error prone task for complex model interpreters of considerable size.”
Jing Zhang. Metamodel-Driven Model Interpreter Evolution. Conference on Object Oriented Programming Systems Languages and Applications, 2005.
“Checking mathematicalproperties like correctness or completeness of transformations based on common programminglanguages is very difficult...”
I. Malavolta, H. Muccini, P. Pelliccione, and D. Tamburri. Providing Architectural Languages and Tools Interoperability through Model Transformation Technologies. IEEE Transactions on Software Engineering, 2009.
“The state-of-the-art of modelinterpreter writing needs to be advanced to enhance thereusability and maintainability of this software...”
G. Karsai. Structured Specification of Model Interpreters. Engineering of Computer-Based Systems, 1999.
“Writing translators by hand...in addition to being inefficient, has yet another serious drawback: the semantic mapping between the input and the output is vaguely specified...[Building model interpreters] is the most time consuming and error prone phase of the MIC approach...”
G. Karsai, A. Agrawal, F. Shi, J. Sprinkle. On the Use of Graph Transformation in the Formal Specification of Model Interpreters. Journal of Universal Computer Science, 2003.
FCS: A Real World Example• > $100 billion US Army
program
• DSL with hundreds of types– Modified on a daily basis
• Automated generation of:– Discrete event simulations– Middleware configuration files– Fault trees– Spreadsheets for documentation
Tool building and maintenance required approximately five full-time MDE experts
Synthesize domain-specific code generators using the same mechanisms that have proven successful for synthesizing domain-specific model editors.
XTEAM Solution Approach
Metamodel Editor
Metamodel Editor
Metamodel
Metamodel
Metamodel Interpreter AMetamodel
Interpreter A
Model Editor Framework
Model Editor Framework
Metamodel Interpreter BMetamodel
Interpreter B
Model Interpreter Framework
Model Interpreter Framework
Target PlatformTarget
Platform
Presentation Semantics
Platform Semantics
Application Model(Abstract
Representation)
Application Model(Abstract
Representation) Executable
ModelExecutable
Model
Types and Views
Presentation Properties
Platform Properties
Presentation Logic
Presentation Rules
Code Generation Logic
Code Generation Rules
Target DisplayTarget Display
Visualized Model
Visualized Model
XTEAM Toolset
12
Windows/C++/Visual Studio
Fedora Linux
SVN Repository
JVM
Prism-MWLightweight
Architectural Middleware
XDEVS Discrete Event
Simulation Engine
GMEModel Editor
GMEModel Editor
XTEAM Metalanguage
XDEVS Metainterpreter
Prism-MW Metainterpreter
GME Metainterpreter
XDEVS MIF
Prism-MW MIF
Prism-MW Applications
(Java)
Prism-MW MIF Extensions
C++
XDEVS MIF Extensions
XDEVS Simulations
(C++)
XTEAMModels
(XML/HTTP)
XTEAMMetamodels(XML/HTTP)
Off-the-Shelf Component
XTEAM Component
Connector
Languages and Platforms
XTEAM DSLs
XTEAM Simulations
• Providing design rationale
• Weighing architectural trade-offs
• Discovering emergent behavior of component assemblies
• Validating component implementations
13
Providing Design Rationale
• Architects rely on intuition and experience to make important decisions early in the design phase– What architectural style to
use– How to allocate functionality
among subsystems– What types of connectors to
use
• XTEAM allows architects to rationalize such decisions with experimental evidence– Model confidence level: Low
Peer-to-peerArchitecture
Client-Server Architecture
PotentialWorkload
0
500
1000
1500
2000
2500
1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96
Resp
on
se T
ime (m
s)
Invocation
Request File Response Time
Weighing Architectural Trade-offs• Nearly all architectural decisions come down to trade-offs
between multiple desirable properties– Emphasis on one system property may yield diminishing returns
• XTEAM allows architects to evaluate design alternatives in terms of their impact on multiple non-functional properties– Model confidence level: Medium
Replication of components
Decreases response time
Consumes more battery power
0
500
1000
1500
2000
2500
1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96
Resp
on
se T
ime (m
s)
Invocation
Request File Response Time
S…
22000
22500
23000
23500
24000
0 58944 104612 175249 239514 287914 352870 415963 480308 529223
Rem
ain
ing
En
erg
y (m
J)
Time (ms)
Host A (iPAQ) Battery Power
Evaluating Component Assemblies
• Contemporary large-scale distributed systems contain numerous off-the-shelf components– Detailed information about the behaviors and properties of
individual components may be known– Component assemblies may exhibit unforeseen behavior due to
subtle interactions between constituent components• XTEAM allows an architect to determine the emergent
properties of a composed system– Model confidence level: High
Off-the-shelf components Highly accurate parameterizationDetermination of
emergent properties
Incremental System Validation• Individual component
implementations may become available in a piecemeal fashion
• XTEAM allows architects to1. Immediately incorporate
component implementations into a simulated system, increasing the accuracy of analysis results
2. Rapidly test individual components in the context of a wide variety of operational scenarios
– Model confidence level: High
Componentimplementation
available
Invoke implementation from behavior model
Integrated simulation and test environment
For More Information
• CSSE Website:http://csse.usc.edu/csse/
• XTEAM Website:http://www-scf.usc.edu/~gedwards/xteam.html