Model Driven Generative Programming
E N D
Presentation Transcript
ECE1770: Trends in Middleware Systems Model Driven Generative Programming Reza Azimi February 6, 2003
High Level Language Program Model Machine Code Compiler Model Compiler Raising Level of Abstraction Motivations • Easy to use • Platform independent • Too hard to program and debug • Too machine- specific • Still hard to program • Still platform-specific • Hard to reuse
Model-Driven Programming • Goal • To create an abstract (platform-independent), complete, precise, and executable model of the system. • Advantages • Reduced required development effort • Early system debugging • Challenges • Is there such a model? • How do we verify a model? • How do we translate a model to code?
What should be modeled? • Data objects • contents, relations, constraints • Objects lifetime • states, and transitions • Objects interactions • message exchange, calls • Objects actions • computable algorithms • Concurrency and synchronization • timing constraints (e.g. Real-time systems)
Unified Modelling Language (UML) • Abstract • Platform independent • Readable by non-technical people • Complete (?) • Formal action semantics • Precise model for concurrency and synchronization • Used widely • Capable enough for modeling large systems
Modeling Data Objects • Class Diagram
Modeling Behaviour State Charts Collaboration Diagrams
Modeling Actions • Action Semantics • Object and attribute actions • Selection expressions • Link actions • Control structures (loops and if-then-else)
Model Checking • Automatic Verification • Completeness • Consistency • Debugging • Generating test cases • Executing the model
Model Compilers • Design Patterns • Translation Rules • Pre-built Libraries
Design Patterns • An abstract template for solving a well-known problem • Creational Patterns • Abstract Factory, Builder, etc. • Structural Patterns • Adapter, Bridge, Proxy, etc. • Behavioural Patterns • Interpreter, Iterator, Mediator, etc.
Translation Rules .for each object in O_OBJ public class ${obj.name} extends SateMachine { private SateMachineSate currentState .select many attributes related by object->O_ATTR[R105] .for each attribute in attributes private ${attribute.implType} ${attribute.name} .end for . . .select many signals related by object->SM_EVT[R303] .for each signal in signals protected void ${signal.name}() throws ooaException; .end for } .emit to file {obj.name}.java .end for Highlights of a translation rule that creates a Java Class
Existing Tools • BridgePoint • By Project Technologies • http://www.projtech.com • Kabira • http://www.kabira.com
Conclusions • Potentials • Faster software development • Early defect removal • Faster technology adoption • Limitations • Model compilers • Effectiveness • Complexity