23
Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa [email protected] http://www.eecs.uottawa.ca/~tcl http://www.umple.org

Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa [email protected] tcl

Embed Size (px)

Citation preview

Page 1: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Umple Toolkit forModel-Oriented Programming

NECSIS Webinar, May 3 2013

Timothy C. Lethbridge, University of Ottawa

[email protected]

http://www.eecs.uottawa.ca/~tcl

http://www.umple.org

Page 2: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Model-Oriented Programming (in general)

A new software development paradigm where modeling abstractions can be freely mixed with programming abstractions in the same development artifacts

Uses a textual syntax that supports the above

Compatible with diagrams, but a diagram is just a view

Implies/enables

• model-driven development

• executable models

T. Lethbridge Umple NECSIS Webinar - May 2013 2

Page 3: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Umple: Simple, Ample,UML Programming Language

1. Textual model-oriented programming tool for UML++

• Class diagrams, state diagrams

• Patterns, aspects, concurrency, constraints, tracing

• Embeds in C++/Java or vice-versa

• Separation of concerns by mixins, aspects

2. State-of-the-art, open source code generator

• Java, C++, XMI, others

• The only one that has

—Infinitely nested state machines, with concurrency

—Proper referential integrity and multiplicity constraints

T. Lethbridge Umple NECSIS Webinar - May 2013 3

Page 4: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Why Umple and MOP?Human-readable text is preferred by many developers

• Can be manipulated, searched with many tools

• Great for version control & variability modeling

Modeling concepts are just one further step in the increasing abstraction of programming

• Text and diagrams are interchangable views of a system

Need for ‘better’ formality and model executability

Research showed that graphical modeling tools are too heavyweight in many contexts

T. Lethbridge Umple NECSIS Webinar - May 2013 4

Page 5: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Key Umple Tools

UmpleOnline [Demo http://try.umple.org ]

• For demonstrations

• For education

• For exploring ideas quickly

Command line compiler [Demo]

• For traditional programmers, build machines

Eclipse Plugin

• For use like any other compiler in Eclipse

• For merging with other Eclipse-based modeling tools

T. Lethbridge Umple NECSIS Webinar - May 2013 5

Page 6: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Selected Umple features

Attributes

• http://attributes.umple.org

Associations

• http://associations.umple.org

• Notice the inline and independent associations

State Machines

• http://statemachines.umple.org

• Switch to ‘GraphViz state diagram’ in the options menu

T. Lethbridge Umple NECSIS Webinar - May 2013 6

Page 7: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Demos of generated code

Java and Javadoc demo

• http://helloworld.umple.org

Real time C++ demo

T. Lethbridge Umple NECSIS Webinar - May 2013 7

Page 8: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

How can Umple be Used?1. Model-driven development

a) Start with a UML model

• Extensive code from this will be generated

b) Then embed other needed code in it

• Main method, special algorithms

• Can embed and generate for different languages

• Code can be in different mixed in files

T. Lethbridge Umple NECSIS Webinar - May 2013 8

Page 9: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

How can Umple be Used?2. Umplification of legacy code

a) Start with an existing system in any textual language

b) Embed Umple in it to incrementally replace boilerplate code and raise abstraction

We have done this automatically with JHotDraw

PhD student Miguel Garzon’s thesis

T. Lethbridge Umple NECSIS Webinar - May 2013 9

Page 10: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

How can Umple be Used?3. Lightweight modeling and prototyping

Sketch a model and analyse it

Draw pictures starting with a textual format

• Tends to be faster than using a GUI

• Expecially for editing and what-if exploration

T. Lethbridge Umple NECSIS Webinar - May 2013 10

Page 11: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

How can Umple be Used?4. Adjunct to existing tools (Rhapsody/Simulink)

Alternative code generation

Alternative model editing

Variability modeling

Integration of existing code with models generated by these tools

Small-scale adding of modeling concepts to existing code

T. Lethbridge Umple NECSIS Webinar - May 2013 11

Page 12: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Keys to Quality:A. Umple is written in itself

Umple.ump is a central file

• http://code.google.com/p/umple/source/browse/trunk/cruise.umple/src/Umple.ump

Grammar DSL: Online

• http://grammar.umple.org

• (we migrated from Antlr to better handle embedded code blocks and gain flexibility)

T. Lethbridge Umple NECSIS Webinar - May 2013 12

Page 13: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Keys to Quality:Umple in itself - 2

Umple’s own class diagram generated by itself, from itself:

• http://metamodel.umple.org

• Colours represent key subsystems

• Click on classes to see Javadoc, and then Umple Code

T. Lethbridge Umple NECSIS Webinar - May 2013 13

Page 14: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Keys to Quality:B. TDD with100% pass always required

Multiple levels:

• Parsing tests: basic constructs

• Metamodel tests: ensure it is populated properly—E.g.

http://code.google.com/p/umple/source/browse/trunk/cruise.umple/test/cruise/umple/compiler/AssociationTest.java

• Implementation template tests: to ensure constructs generate code that looks as expected

• Testbed semantic tests: Generate code and make sure it behaves the way it should

T. Lethbridge Umple NECSIS Webinar - May 2013 14

Page 15: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Keys to Quality:C. Continuous integration

Small increments compiled frequently http://cc.umple.org

• Single trunk, no branches for now

Online QA report: http://qa.umple.org

T. Lethbridge Umple NECSIS Webinar - May 2013 15

Page 16: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Future Directions:1. Real Time and Autosar Compliance

1. Extensions to Umple syntax to allow for textual declaration of Autosar capabilities

2. Autosar-compliant code generation in C and C++

• Potential uses

—R&D of new automotive features

—Replacement or complement to existing tools

Part of the work of Mahmoud and Ahmed Orabi

Also working with Prof. G. Bochmann + Aliaa Alghamdi

• Plan to generate code for GM adaptive cruise control

T. Lethbridge Umple NECSIS Webinar - May 2013 16

Page 17: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Future Directions:2. Multidimensional Separation of Concerns

Umple synergistically combines

• Mixins

• Limited aspect oriented capabilities (to be extended)

Umple also has a feature modeling capability that will be integrated in the main system soon

• http://try.umple.org/vml.php

Future work on this topic: Vahdat Abdelzad

• Potential linkage with Clafer

T. Lethbridge Umple NECSIS Webinar - May 2013 17

Page 18: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Future Directions:3. Formalism Done Right

Step 1: Formally specify Umple syntax and semantics

• Already a restricted subset of UML with some extensions

Step 2: Since Umple is written in itself, the Umple compiler can become formally specified

A path to certifiable code for safety cases

• Generated code is designed to be readable and of highest quality

Work of future student Adesina Opeyemi

• Collaboration with Prof. Stéphane Somé

T. Lethbridge Umple NECSIS Webinar - May 2013 18

Page 19: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Future Directions:4. Import/Export and Integration

Under consideration: Embed Umple in Rhapsody

• Work with UML models textually

• Could use Rhapsody or Umple code generators

• Option to support OMG’s Alf

Read XMI, Simulink models and transform to Umple

• Will allow textual manipulation

Have had discussions with OMG about conforming to new standard XMI testcases

Discussed with tool vendors about Umple support

T. Lethbridge Umple NECSIS Webinar - May 2013 19

Page 20: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Future Directions:5. Instrumenting & Tracing at the Model level

Modeling sublanguage MOTL

• Specify trace cases to instrument execution under certain conditions

Current work of PhD student Hamoud Aljamaan

T. Lethbridge Umple NECSIS Webinar - May 2013 20

Page 21: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Future Directions:6. Model Analysis

Metrics

• Synergistically analyse the combination of code and model

• Code metrics + model metrics

• Find hotspots, excessive coupling, etc.

Work done in part by Antonio Resende

• visiting Postdoc from Brasil

Umple already has extensive analysis to point out problems in UML models: en.error

T. Lethbridge Umple NECSIS Webinar - May 2013 21

Page 22: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Future Directions:7. Become and Eclipse Foundation Project

Discussions have started

T. Lethbridge Umple NECSIS Webinar - May 2013 22

Page 23: Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May 3 2013 Timothy C. Lethbridge, University of Ottawa tcl@eecs.uottawa.ca tcl

Questions?

T. Lethbridge Umple NECSIS Webinar - May 2013 23