Exploring a Model-Oriented and Executable Syntax for UML Attributes SERA 2013SERA 2013 (August 7, 2013 in Prague, Czech Republic) Omar Badreddin, Andrew.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Based on Java Software Development, 5th Ed. By Lewis &Loftus
The Line Class Suppose you are involved in the development of a large mathematical application, and this application needs an object to represent a Line.
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
Composition CMSC 202. Code Reuse Effective software development relies on reusing existing code. Code reuse must be more than just copying code and changing.
Inheritance Inheritance Reserved word protected Reserved word super
COMP 110 Introduction to Programming Mr. Joshua Stough October 8, 2007.
1 Fall 2007ACS-1903 Chapter 6: Classes Classes and Objects Instance Fields and Methods Constructors Overloading of Methods and Constructors Scope of Instance.
1 Creating Classes. 2 Writing Classes Thus far, we have mainly used existing classes in the Java library  (also main classes for executing) True object-oriented.
Chapter 11: Inheritance and Polymorphism Java Programming: Program Design Including Data Structures Program Design Including Data Structures.
SCHOOL OF COMPUTING QUEEN’S UNIVERSITY 08/03/2013 Andrew Forward, Omar Badreddin, Timothy C. Lethbridge, and Julian Solano School of Electrical Engineering.
The Umple Model-Oriented Programming Technology: Easy-to-Use Open-Source Code Generation Code Generation 2013, Cambridge UK Timothy C. Lethbridge, University.
Model-Oriented Programming: Bridging the Model-Code Divide Modeling in Software Engineering (MiSE 2013) Omar Badreddin, Timothy C. Lethbridge University.
Using Jeroo To Teach Object-Oriented Concepts By Christian Digout.
Modeling Practices in Open Source Software OSS 2013 Koper-Capodistria, Slovenia Omar Badreddin Post Doctoral Fellow, University of Ottawa
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
More Object Concepts Chapter 4.  Our class is made up of several students and each student has a name and test grades  How do we assign the variables.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Chapter 8. About the Midterm Exam.. Exam on March 12 Monday (Tentatively) Review on March 7 Wednesday Cover from Chapter 6 Grades will be out before spring.
1 Relational Expressions Relational expressions: –Expressions that compare operands –Sometimes called conditions –Evaluated to yield a result –Typically.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
OOP IN PHP `Object Oriented Programming in any language is the use of objects to represent functional parts of an application and real life entities. For.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
Chris Kiekintveld CS 2401 (Fall 2010) Elementary Data Structures and Algorithms Inheritance and Polymorphism.
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
Abstract We present two Model Driven Engineering (MDE) tools, namely the Eclipse Modeling Framework (EMF) and Umple. We identify the structure and characteristic.
Improving Code Generation for Associations: Enforcing Multiplicity Constraints and Ensuring Referential Integrity SERA 2013SERA 2013 (August 7, 2013 in.
Peyman Dodangeh Sharif University of Technology Fall 2014.
Applying a Research Prototype Tool in Industrial Practice Ottawa Carleton Institute for Computer Science Umple: a Model Oriented Programming Language University.
Chapter 4&5 Defining Classes Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Teaching UML Using Umple: Applying Model-Oriented Programming in the Classroom CSEE&T 2011 Timothy C. Lethbridge, Gunter Mussbacher, Andrew Forward and.
CIS 270—Application Development II Chapter 8—Classes and Objects: A Deeper Look.
Static. 2 Objectives Introduce static keyword –examine syntax –describe common uses.
CMSC 202 Inheritance II. Version 10/092 Inherited Constructors? An Employee constructor cannot be used to create HourlyEmployee objects. Why not? We must.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Chapter 16 UML Class Diagrams.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Extracting Sequence.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Oct Interchangability in Software Design Notation - Timothy C. Lethbridge Interchangability in software design notation: programs models visual.
Topic 8Classes, Objects and Methods 1 Topic 8 l Class and Method Definitions l Information Hiding and Encapsulation l Objects and Reference Classes, Objects,
Unified Modeling Language (UML)
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Powerpoint slides from A+ Computer Science Modified by Mr. Smith for his course.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Unified Modeling Language
CSCI 51 Introduction to Programming Dr. Joshua Stough February 26, 2009.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Advanced Programming in Java
Modern Programming Tools And Techniques-I
Creating Your Own Classes
Chapter No. : 1 Introduction to Java.
Chapter 16 UML Class Diagrams.
Applying a Research Prototype Tool in Industrial Practice
Introduction to Classes
Advanced Programming in Java
Introduction to Classes
Implementing Non-Static Features
Advanced Programming Behnam Hatami Fall 2017.
Units with – James tedder
Umple Mini-Course Part 1: The Basics
Today’s topics UML Diagramming review of terms
Object-Oriented PHP (1)
Timothy C. Lethbridge, Andrew Forward, Omar Badreddin
Presentation transcript:

Exploring a Model-Oriented and Executable Syntax for UML Attributes SERA 2013SERA 2013 (August 7, 2013 in Prague, Czech Republic) Omar Badreddin, Andrew Forward, Timothy C. Lethbridge1 University of Ottawa / / Exploring a Model-Oriented and Executable Syntax for UML Attributes 1

Overview Model Oriented Programming Umple Overview Attributes in Practice Umple Attribute Syntax Attribute Code Generation 2 Exploring a Model-Oriented and Executable Syntax for UML Attributes

The philosophy of Model-Oriented Programming (MOP) MOP 3 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Embed Models In Code 4 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Unify programs and models 5 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Supports Modeller and Programmer workflows Model-FirstIncremental Re- Engineering 6 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Text Diagram Duality 7 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Reduce Need to Round-Trip 8 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Easily Integrate with Text-Based Tooling 9 Exploring a Model-Oriented and Executable Syntax for UML Attributes

A MOP technology and language family Umple 10 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Why call it Umple? UML Programming Language Ample Simple 11 Exploring a Model-Oriented and Executable Syntax for UML Attributes

What does Umple support? Modeling abstractions Associations, Attributes, State machines (both simple and composite), model based tracing, and simple debugging. Supported languages Java, C++, Ruby, PhP Integration support XMI for model exchange, Ecore, textUML, Yuml, GraphViz, SQL 12 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Attributes In Practice Google Code: fizzbuzz ExcelLibrary Ndependencyinjection Java Bug Reporting SourceForge: jEdit Freemaker Freecode: Java Financial Library 1831 variables 620 static 1211 instance 469 classes 13 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Variable Distribution 14 Static (Class) Variables Member (Object) Variables E.g. avoiding magic numbers and state symbols (i.e. LEFT_NODE, RIGHT_NODE) Mostly counts, names and booleans (51%) Exploring a Model-Oriented and Executable Syntax for UML Attributes A lot of other object types

Attribute Identification 15 About 33% had attribute-like methods implementations Surprising that 35% had no external access at all Exploring a Model-Oriented and Executable Syntax for UML Attributes

Attribute Code Generation 16 Over half were simple boiler- plate implementations Exploring a Model-Oriented and Executable Syntax for UML Attributes

Observations Many simple set and get methods Drastic reduction in boiler-plate code Few truly immutable attributes Few attributes set in constructor Immutability needed for proper hash code (Java) Attribute multiplicities typically ‘one’ Basic multiplicity (0..1, 1, 0..*) available for attributes 17 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Umple Attributes class Student { // defaults to String studentNumber; String grade; Integer entryAverage; } 18 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Umple Data Types Umple treats the following attribute types as special String (always the default if unspecified) Integer Double Boolean Date, Time Code generation from the above will generate suitable types in the underlying language (Java, PHP, etc.) Umple classes can be used as types, but consider associations instead 19 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Initializing Attributes class Student { // Initial value set to “Unknown”, // not required in class constructor name = "Unknown"; // Initialized, but can also be reset defaulted type = “FullTime”; // Name initialized to null in // constructor lazy program; } 20 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Immutable Attributes class Student { // Cannot be changed after set in constructor immutable idNumber; // Can be set once, right after construction, // and is immutable after that // Useful for frameworks where objects are // created without initializing values lazy immutable barcode; } 21 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Derived Attributes class Rectangle { Integer l; Integer w; // Derived Attributes Integer perimeter = { 2*getL() + 2*getW() } Integer area = { getL() * getW() } } 22 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Additional Attribute Options class Student { // Umple assigns the next // available number autounique id; // Creates a constant value const Integer MAX_NUM_COURSES = 8; } class Address { // An address has many lines String[] lines; } 23 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Attribute Code Generation (1) class Rectangle { name = "Rectangle"; Integer length; Integer width; Integer area = {getLenth() * getWidth()} } 24 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Attribute Code Generation (2) // line 2 "model.ump" public class Rectangle umplesourcefile{int[] line();String[] file();int[] javaline();int[] length();} // // MEMBER VARIABLES // //Rectangle Attributes private String name; private int length; private int width; // // CONSTRUCTOR // public Rectangle(int aLength, int aWidth) { name = "Rectangle"; length = aLength; width = aWidth; } // // INTERFACE // public boolean setName(String aName) { boolean wasSet = false; name = aName; wasSet = true; return wasSet; } public boolean setLength(int aLength) { boolean wasSet = false; length = aLength; wasSet = true; return wasSet; } public boolean setWidth(int aWidth) { boolean wasSet = false; width = aWidth; wasSet = true; return wasSet; } public String getName() { return name; } public int getLength() { return length; } public int getWidth() { return width; public int getArea() { return getLenth() * getWidth(); } public void delete() {} public String toString() { String outputString = ""; return super.toString() + "["+ "name" + ":" + getName()+ "," + "length" + ":" + getLength()+ "," + "width" + ":" + getWidth()+ "," + "area" + ":" + getArea()+ "]" + outputString; } 25 Constructor based on attributes missing an initial value Set method returns a boolean (was it “set” or not) Simple get method Derived methods do not have internal members Exploring a Model-Oriented and Executable Syntax for UML Attributes

Try It Yourself 26 Exploring a Model-Oriented and Executable Syntax for UML Attributes

Summary 27 Umple features can be created and viewed diagrammatically or textually Umple extends a base language in a minimally invasive way Intermediate generated code should not be edited = Modeling is programming and vice versa No round-trip engineering required Exploring a Model-Oriented and Executable Syntax for UML Attributes

Getting involved Open source project: Teaching Use Umple to introduce UML and MDE. Umplification Incrementally replace boilerplate code with modeling abstractions Lightweight Modeling and Analysis Visualize Umple source as UML diagrams to analyze it Model driven development Generate code in one of the supported base languages Comments and feedback: 28 Exploring a Model-Oriented and Executable Syntax for UML Attributes

More information Publications on Umple: The User Manual: Umple Home page: Download Umple: e_plugin.html e_plugin.html Report an issue: 29 Exploring a Model-Oriented and Executable Syntax for UML Attributes

30 Exploring a Model-Oriented and Executable Syntax for UML Attributes