Models 2015 M. Garzón, A. Forward, and T. Lethbridge

Slides:



Advertisements
Similar presentations
ANT: Another Nice Tool Ali Beyad October 1, 2003.
Advertisements

Database Systems: Design, Implementation, and Management Eighth Edition Chapter 6 Advanced Data Modeling.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 6 Advanced Data Modeling.
Liang,Introduction to Java Programming,revised by Dai-kaiyu 1 Chapter 10 Object-Oriented Modeling.
Whole Platform Tesi di Dottorato di: RICCARDO SOLMI Università degli Studi di Bologna Facoltà di scienze matematiche, fisiche e naturali Corso di Dottorato.
Exploring a Model-Oriented and Executable Syntax for UML Attributes SERA 2013SERA 2013 (August 7, 2013 in Prague, Czech Republic) Omar Badreddin, Andrew.
Using Ant to build J2EE Applications Kumar
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
The Umple Model-Oriented Programming Technology: Easy-to-Use Open-Source Code Generation Code Generation 2013, Cambridge UK Timothy C. Lethbridge, University.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Model-Oriented Programming: Bridging the Model-Code Divide Modeling in Software Engineering (MiSE 2013) Omar Badreddin, Timothy C. Lethbridge University.
Modeling Practices in Open Source Software OSS 2013 Koper-Capodistria, Slovenia Omar Badreddin Post Doctoral Fellow, University of Ottawa
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
Model Oriented Programming: An Empirical Study of Comprehension Omar Badreddin Andrew Forward Timothy C. Lethbridge try.umple.org.
Umple Toolkit for Model-Oriented Programming NECSIS Webinar, May Timothy C. Lethbridge, University of Ottawa
Improving Code Generation for Associations: Enforcing Multiplicity Constraints and Ensuring Referential Integrity SERA 2013SERA 2013 (August 7, 2013 in.
Applying a Research Prototype Tool in Industrial Practice Ottawa Carleton Institute for Computer Science Umple: a Model Oriented Programming Language University.
Teaching UML Using Umple: Applying Model-Oriented Programming in the Classroom CSEE&T 2011 Timothy C. Lethbridge, Gunter Mussbacher, Andrew Forward and.
Chapter 1 Introducing Ant. What is ant? Ant is a build tool  Automate the tasks of compiling code, running test, and packaging the results for redistribution.
LanguageLab A Meta-modelling Environment Terje Gjøsæter and Andreas Prinz, University of Agder, Norway SDL Forum 2015, Berlin, Germany.
Separation Of Concerns: Mixins + Variability Models + Aspects in Umple CSER – June 2013 – Montreal Timothy C. Lethbridge, University of Ottawa
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 11 Object-Oriented.
® IBM Software Group © 2007 IBM Corporation Module 1: Getting Started with Rational Software Architect Essentials of Modeling with IBM Rational Software.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
Notices Assn 2 is due tomorrow, 7pm. Moodle quiz next week – written in the lab as before. Everything up to and including today’s lecture: Big Topics are.
M&CML: A Monitoring & Control Specification Modeling Language
PARTNER UPDATE V9 MILESTONE 1 & 2.
INTRO. To I.T Razan N. AlShihabi
Agenda:- DevOps Tools Chef Jenkins Puppet Apache Ant Apache Maven Logstash Docker New Relic Gradle Git.
Top 8 Best Programming Languages To Learn
Component 1.6.
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
The Movement To Objects
Systems Analysis and Design
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Object-Oriented Analysis and Design
SysML v2 Formalism: Requirements & Benefits
Systems Analysis and Design With UML 2
Chapter 11 Object-Oriented Design
Applying a Research Prototype Tool in Industrial Practice
Software Design and Architecture
Systems Analysis and Design With UML 2
Review: Two Programming Paradigms
Arrays and files BIS1523 – Lecture 15.
SVTRAININGS. SVTRAININGS Python Overview  Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed.
Computer Programming.
Chapter 2 Database Environment Pearson Education © 2009.
Chapter 2 Database Environment.
Design and Programming
The Object-Oriented Thought Process Chapter 05
Hands-on Introduction to Visual Basic .NET
Introduction to Systems Analysis and Design
CIS16 Application Development – Programming with Visual Basic
Evaluating Compuware OptimalJ as an MDA tool
Chapter 1 Introduction(1.1)
Umple Mini-Course Part 1: The Basics
Constructing MDA-based Application Using Rational XDE for .NET
An Introduction to Software Architecture
Chapter 7 –Implementation Issues
Teaching Effective UML Modeling by Combining it with Programming
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Chapter 2 Database Environment Pearson Education © 2009.
Chapter 2 Database Environment Pearson Education © 2009.
Review of Previous Lesson
Timothy C. Lethbridge, Andrew Forward, Omar Badreddin
Software Engineering and Architecture
Software Architecture & Design
Implementation Plan system integration required for each iteration
Presentation transcript:

Models 2015 M. Garzón, A. Forward, and T. Lethbridge Textual Modeling and Model-Oriented Programming using Umple Tutorial Slides www.umple.org Models 2015 M. Garzón, A. Forward, and T. Lethbridge

Motivation From our studies of practitioners Code generation is weak in widely-deployed tools Tools are awkward, do not interoperate Modellers mostly do it for documentation make important errors From our teaching of modeling Students learned syntax, but failed to learn Semantics Pragmatics To create implementable models due to lack of feedback Umple Tutorial M. Garzon and A. Forward

Umple: Simple, Ample, UML Programming Language 1. Open source code generator for UML The only one that has Infinitely nested state machines, with concurrency Proper referential integrity and multiplicity constraints on associations 2. Textual modelling tool set Command line compiler Web-based tool (UmpleOnline) for demos and education Eclipse plugin 3. Pre-processor to add UML, patterns and other features on top of Java, PhP and other languages Umple Tutorial M. Garzon and A. Forward

Exercise: Compiling and Changing a Model Go to http://helloworld.umple.org Look at the example at the bottom Observe: attribute, association, class hierarchy, mixin Click on Load the above code into UmpleOnline Observe and modify the diagram Add an attribute Make a multiplicity error, then undo Generate code and take a look Download, compile and run if you want Umple Tutorial M. Garzon and A. Forward

Hello World Example in the User Manual Umple Tutorial M. Garzon and A. Forward

Hello World Example in UmpleOnline Umple Tutorial M. Garzon and A. Forward

State machine example in UmpleOnline Umple Tutorial M. Garzon and A. Forward

State machine detail in the user manual http://statemachines.umple.org Umple Tutorial M. Garzon and A. Forward

Demo of the command line Umple compiler Follows conventions of gcc Used by ant scripts for building Umple Tutorial M. Garzon and A. Forward

Umple Philosophy 1-4 P1. Modeling is programming and vice versa P2. An Umple programmer should never need to edit generated code to accomplish any task. P3. The Umple compiler can accept and generate code that uses nothing but UML abstractions. The above is the inverse of the following P4. A program without Umple features can be compiled by an Umple compiler. e.g. input Java results in the same as output Umple Tutorial M. Garzon and A. Forward

Umple Philosophy 5-8 P5. A programmer can incrementally add Umple features to an existing program Umplification P6. Umple extends the base language in a minimally invasive and safe way. P7. Umple features can be created and viewed diagrammatically or textually P8. Umple goes beyond UML Umple Tutorial M. Garzon and A. Forward

Umplification Umplification: ‘amplication’ + converting into Umple. Produces a program with behavior identical to the original one, but written in Umple. Eliminates the distinction between code and model. Proceeds incrementally until the desired level of abstraction is achieved. Umple Tutorial M. Garzon and A. Forward

Umplification: The Transformation Steps Transformation 0: Initial transformation Transformation 1: Transformation of generalization, dependency, and namespace declarations. Transformation 2: Analysis and conversion of many instance variables, along with the methods that use the variables. Transformation 2a: Transformation of variables to UML/Umple attributes. Transformation 2b: Transformation of variables in one or more classes to UML/Umple associations. Transformation 2c: Transformation of variables to UML/Umple state machines. Umple Tutorial M. Garzon and A. Forward

Umplification Process Umple Tutorial M. Garzon and A. Forward

Umplificator Architecture Umple Tutorial M. Garzon and A. Forward

Systems umplified JhotDraw 7.5.1 Umple Tutorial M. Garzon and A. Forward

Systems umplified JhotDraw 7.5.1 Umple Tutorial M. Garzon and A. Forward

Systems umplified Weka – Associations umplified Args4J- Modernization Original Args4j source code is composed of 61 classes and 2223 LOC. Umplified Args4j source code is composed of 122 (2 per input class) umple files and 1980 LOC. # LOC in files containing modeling constructs (X.ump) is 312. # LOC in files with algorithmic/logic code (X code.ump) is 1668. The developer must then translate 1518 lines of code rather than 2223 lines of code. Umple Tutorial M. Garzon and A. Forward

Attributes in Umple More than just variables http://attributes.umple.org Umple Tutorial M. Garzon and A. Forward

Attributes http://attributes.umple.org Attributes are a familiar occurrence, they are very similar to instance variables, but not identical. http://attributes.umple.org

Attributes Exercise #1

Code Generation (JavaDocs)

Associations in Umple Associations http://associations.umple.org Notice the inline and independent state machines Umple Tutorial M. Garzon and A. Forward

Associations Associations are a first class entities in Umple. We support 42 unique combinations of directional, bidirectional and reflexive associations. Each implemented with their own unique semantics. Textually, you can inline associations directly within one side of the relationship. http://associations.umple.org/

Associations Exercise #1 Answer: class Shape2D { } class EllipticalShape { isA Shape2D; semiMajorAxis; } class Polygon {

Associations Exercise #2 Answer: class Shape2D { center; } class EllipticalShape { isA Shape2D; semiMajorAxis; class Polygon { class Circle { isA EllipticalShape; class Ellipse{ class SimplePolygon { orientation; isA Polygon; class ArbitraryPolygon { points; class Rectangle { isA SimplePolygon; height; width; class RegularPolygon { numPoints; radius;

Association Relationships Directional Associations * -> 0..1, * -> 1, * -> *, * -> m..n, * - >n, *->m..* and*->0..n. Symmetric Reflexive 0..1, 0..n, *, 1, n, m..n,m..*

Code Generation Patterns Attributes Set/Get (UB = 1) Add/Remove/NumberOf/IndexOf/Get (UB > 1) Lazy immutability Default values Constants Before / After cod Associations Set/Get (UB = 1) Add/Remove/NumberOf/IndexOf/Get (UB > 1) Referential Integrity Multiplicity Constraints 42 different cases UB = upper bound UB = upper bound

Code Generation (Sematics) http://api.umple.org

Umple Examples... https://github.com/umple/umple/wiki/examples http://try.umple.org https://github.com/umple/umple/wiki/examples

Umple Example Database http://try.umple.org http://umpr.a4word.com/

More example databases? Contact us through github.com/umple

Umple Plugin For Sublime 3 To Install cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User git clone https://github.com/umple-ucsop/umple.sublime.git ./umple

Command Line Compiler Demo

Build Scripts https://github.com/umple/Umple/wiki/CheatSheet Ant based scripts One master build.xml, with several project specific build.<proj>.xml Chains commands together instead of dependency heirarchies https://github.com/umple/Umple/wiki/CheatSheet

Docker Container (experimental) https://hub.docker.com/u/umple/dashboard/ mkdir ~/src && cd ~/src && git clone git@github.com:umple/umple.git docker run -i -t -v `pwd`:/src umple/umple:0.4.0 bash

Umple Architecture We migrated from Antlr to better handle embedded code blocks and gain flexibility, we have tried Xtext and Xtend, but kept with the internal design as the others did not support our needs of supporting several output languages. The colours represent key subsystems, and click on the classes to see Javadoc and then UmpleCode http://metamodel.umple.org http://grammar.umple.org/

Umple written in Umple http://code.umple.org Umple is written in itself. We use much of the available modelling constructs, and compile down to Java for the action semantics. The meta-model, is live, and represent exactly the design. Please note the original versions were written in http://code.umple.org http://metamodel.umple.org

Original (Pre-Umple) Meta-Model Umple was not available, so issues arose between the developer transcribing the model and the model itself Before Umple was available, we used a modeling tool to help design the first version. Unfortunately the transcription into Java introduced discrepancies and if you look closely at the current meta model, there are actually undesirable additional classes.

State Machines (native Umple) Original Design State machines were written designed purely in Umple. Here is the original design from 2008. Note that this was generated directly from Umple and represents 100% accurately the model that was implemented.

State Machines Current Design Here is a slice of the State Machine design from the current source (also available from metamodels.umple.org). I have trimmed out the mixins, but overall following 5+ years of development, the purety of the design has remained relatively intact despite many additional features such as Model Tracing, Model Trails, Concurrency and Deep History on state machines.

Umple Data Flow Each hand-off is tested individually, as well as within each individual output

TDD Philosophy http://cc.umple.org

Continuous Integration and Deployment http://qa.umple.org http://cc.umple.org

Benefits of Umple Used in production systems Umple developed in itself (60+ developers) Empirical Studies Umple code is easier to understand than Java Helps students learn to model: CSEE&T

Production Examples (PHP) Model your PHP applications Moddel layer written in Umple (app/mode) and generates php (app/classes) Integration with existing PHP frameworks like Zend, Slim, CodeIgniter Integration with testing frameworks Works for websites, web applications and restful APIs java -jar ./vendor/umple/umple.jar \ --generate Php \ --path ../classes \ ./app/models/app.ump

Additional Features http://manual.umple.org Generation Templates Concurrency Constraints Patterns Aspect Orientation Tracing Generation Templates Concurrency Constraints Patterns Aspect Orientation Tracing http://manual.umple.org

Umple Architecture 1 Grammar DSL: Online http://grammar.umple.org (we migrated from Antlr to better handle embedded code blocks and gain flexibility) Umple is written in itself Key to testing and reliability Github file umple.ump Umple Tutorial M. Garzon and A. Forward

Umple Architecture 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 Umple Tutorial M. Garzon and A. Forward

Testing: 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 Umple Tutorial M. Garzon and A. Forward

Continuous integration Small increments compiled frequently http://cc.umple.org Single trunk, no branches for now Online QA report: http://qa.umple.org Umple Tutorial M. Garzon and A. Forward

Evidence of benefit Umple in use an a couple of small companies Umple development in itself 60+ developers Empirical studies show Umple code is easier to understand than Java Helps students learn to model: CSEE&T Umple Tutorial M. Garzon and A. Forward

Results of survey Umple in the lab helped me understand concepts Prof. Lethbridge should use it in future courses I will get better grades because of Umple Other tools would have been just as effective I would use Umple in the future, assuming bugs fixed helped me understand concepts Umple in the classroom As of Dec 2010, Umple is too incomplete or buggy Umple Tutorial M. Garzon and A. Forward

Ability to generate code to represent the model Availability of a textual form for models and diagrams Ability to edit diagram or text & have the other reflect changes Umple Tutorial M. Garzon and A. Forward

Comparison of Grades Comparison of 4 offerings of the same course before introducing Umple, and 2 offerings afterwards Midterm examination grades on UML modeling question rose from 75.8% to 82.3% 8.6% improvement Final exam grades on UML modeling questions rose from 76.4% to 83.6% 9.4% improvement Highly statistically significant p<0.00002 on T Test n=332 prior to Umple; n=137 afterwards Similar results in 4th year course SEG4110 No difference in non-UML questions Umple Tutorial M. Garzon and A. Forward

Development effort Umple Tutorial M. Garzon and A. Forward

Additional Umple features in the manual: Generation Templates Concurrency Constraints Patterns Aspect Orientation Tracing Umple Tutorial M. Garzon and A. Forward