Jump to content

Umple

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Timothyclethbridge (talk | contribs) at 19:02, 27 January 2016 (Updating release number). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Umple
Paradigmobject-oriented
Designed byUniversity of Ottawa
DeveloperCruise Group in the Department of Electrical Engineering and Computer Science, Led by Timothy Lethbridge at University of Ottawa
First appeared2008
Stable release
1.23.0 / December 21, 2015 (2015-12-21)
Typing disciplinestatic
PlatformJVM
LicenseMIT License
Filename extensions.ump
Websitewww.umple.org
Influenced by
Java, C++, UML, Ruby, PHP

Umple is a language for both object-oriented programming and modeling with class diagrams and state diagrams. The name Umple is a portmanteau of "UML", "ample" and "programming language", indicating that it is designed to provide ample features to extend programming languages with UML capabilities.

History and Philosophy

The design of Umple started in 2008 at the University of Ottawa. Umple was open-sourced and its development was moved to Google Code in early 2011.

Umple was developed, in part, to address certain problems observed in the modelling community. [1] Most specifically, it was designed to bring modeling and programming into alignment, It was intended to help overcome inhibitions against modeling common in the programmer community. It was also intended to reduce some of the difficulties of model-driven development that arise from the need to use large, expensive or incomplete tools. One design objective is to enabling programmers to model in a way they see as natural, by adding modeling constructs to programming languages.

Features and Capabilities

Umple can be used to represent in a textual manner many UML modelling entities found in class diagrams and state diagrams.[1] Umple can generate code for these in various programming languages. Currently Umple fully supports Java, C++ and PHP as target programming languages and has functional, but somewhat incomplete support for Ruby.

Umple also incorporates various features not related to UML, such as the Singleton pattern, keys, immutability, mixins and aspect-oriented code injection.

The class diagram notations Umple supports includes classes, interfaces, attributes, associations, generalizations and operations. The code Umple generates for attributes include code in the constructor, 'get' methods and 'set' methods. The generated code differs considerably depending on whether the attribute has properties such as immutability, has a default value, or is part of a key.

Umple generates many methods for manipulating, querying and navigating associations it supports all combinations of UML multiplicity and enforces referential integrity.

Umple supports the vast majority of UML state machine notation, including arbitrarily deep nested states, concurrent regions, actions on entry, exit and transition, plus long-lasting activities while in a state. [2] A state machine is treated as an enumerated attribute where the value is controlled by events. Events encoded in the state machine can be methods written by the user, or else generated by the Umple compiler. Events are triggered by calling the method. An event can trigger transitions (subject to guards) in several different state machines. Since a program can be entirely written around one or more state machines, Umple enables automata-based programming.

The bodies of methods are written in one of the target programming languages. The same is true for other imperative code such as state machine actions and guards, and code to be injected in an aspect-oriented manner. Such code can be injected before many of the methods in the code Umple generates, for example before or after setting or getting attributes and associations.

The Umple notation for UML constructs can be embedded in any of its supported target programming languages. When this is done, Umple can be seen as a pre-processor: The Umple compiler expands the UML constructs into code of the target language. Code in a target language can be passed to the Umple compiler directly; if no Umple-specific notation is found, then the target-language code is emitted unchanged by the Umple compiler.

Umple, combined with one of its target languages for imperative code, can be seen and used as a complete programming language. Umple plus Java can therefore be seen as an extension of Java.

Alternatively, if imperative code and Umple-specific concepts are left out, Umple can be seen as a way of expressing a large subset of UML in a purely textual manner. Code in one of the supported programming languages can be added in the same manner as UML envisions adding action language code.

License

Umple is licensed under an MIT-style license

Examples

Here is the classic Hello world program written in Umple (extending Java): [3]

  class HelloWorld {
    public static void main(String [ ] args) {
      System.out.println("Hello World");
    }
  }

This example looks just like Java, because Umple extends other programming languages.

With the program saved in a file named HelloWorld.ump, it can be compiled from the command line:

$ java -jar umple.jar HelloWorld.ump

To run it:

$ java HelloWorld

The following is a fully executable example showing embedded Java methods and declaration of an association.[3]

  class Person {
    name; // Attribute, string by default
    String toString () {
      return(getName());
    }
  }
  
  class Student {
    isA Person;
  }
  
  class Mentor {
    isA Person;
  }
  
  association {
    0..1 Mentor -- * Student;
  }
  
  class Person {  
    public static void main(String [ ] args) {
      Mentor m = new Mentor("Nick The Mentor");
      Student s = new Student("Tom The Student");
      s.setMentor(m);
      System.out.println("The mentor of "  + s  + " is " +  s.getMentor());
      System.out.println("The students of " +  m  + " are " +  m.getStudents());
    }
  }

The following example describes a state machine called status, with states Open, Closing, Closed, Opening and HalfOpen, and with various events that cause transitions from one state to another. [4]

 class GarageDoor
 {
    status {
       Open { buttonOrObstacle -> Closing;  }
       Closing {
           buttonOrObstacle -> Opening;
           reachBottom -> Closed;
       }
       Closed { buttonOrObstacle -> Opening; }
       Opening {
           buttonOrObstacle -> HalfOpen;
           reachTop -> Open;
       }
       HalfOpen { buttonOrObstacle -> Opening; }
   }
 }

Umple use in Practice

The first version of Umple was written in Java, but that Java code was later converted to Umple following a process called Umplification.[5] Umple is therefore now written in itself.

Umple and UmpleOnline have been used in the classroom by several instructors to teach UML and modeling. In one study it was found to help speed up the process of teaching UML, and was also found to improve the grades of students.[6]

Tools

Umple is available as a Jar file so it can be run from the command line, and as an Eclipse plugin.

There is also an online tool for Umple called UmpleOnline [7] , which allows a developer to create an Umple system by drawing a UML class diagram, editing Umple code or both. Umple models created with UmpleOnline are stored in the cloud. Currently UmpleOnline only supports Umple programs consisting of a single input file.

In addition to code, Umple's tools can generate a variety of other types of output, including user interfaces based on the Umple model.[8]

See also

References

  1. ^ a b Andrew Forward (2010). "The Convergence of Modeling and Programming: Facilitating the Representation of Attributes and Associations in the Umple Model-Oriented Programming Language". PhD Thesis, University of Ottawa.
  2. ^ Omar Badreddin (2012). "A Manifestation of Model-Code Duality: Facilitating the Representation of State Machines in the Umple Model-Oriented Programming Language". PhD Thesis, University of Ottawa.
  3. ^ a b "Hello World Examples". Umple User Manual. 2013.
  4. ^ "Basic State Machines". Umple User Manual. 2013.
  5. ^ Timothy C. Lethbridge, Andrew Forward, Omar Badreddin (October 2010). "Umplification: Refactoring to Incrementally Add Abstraction to a Program". 17th Working Conference on Reverse Engineering, pp. 220-224.{{cite web}}: CS1 maint: multiple names: authors list (link)
  6. ^ Timothy C. Lethbridge, Gunter Mussbacher, Andrew Forward, Omar Badreddin (May 2011). "Teaching UML using umple: Applying model-oriented programming in the classroom". 24th IEEE-CS Conference on Software Engineering Education and Training, pp. 421-428.{{cite web}}: CS1 maint: multiple names: authors list (link)
  7. ^ CRuiSE group, University of Ottawa. "Umple Online".
  8. ^ Andrew Forward, Omar Badreddin, Timothy C. Lethbridge, Julian Solano (July 2012). "Model-driven rapid prototyping with Umple". Software: Practice and Experience, Vol. 42, No. 7. pp. 781-797.{{cite web}}: CS1 maint: multiple names: authors list (link)