Umple

Last updated
Umple
Umple Logo.png
Paradigm object-oriented
Designed by University of Ottawa
Developer Cruise Group in the Department of Electrical Engineering and Computer Science, Led by Timothy Lethbridge at University of Ottawa
First appeared2008
Stable release
1.33.0 / January 10, 2024 (2024-01-10)
Typing discipline static
Platform JVM
License MIT License
Filename extensions .ump
Website www.umple.org
Influenced by
Java, C++, UML, Ruby, PHP

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

Contents

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 and to GitHub in 2015.

Umple was developed, in part, to address certain problems observed in the modelling community. [2] Most specifically, it was designed to bring modelling and programming into alignment, It was intended to help overcome inhibitions against modelling 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 enable programmers to model in a way they see as natural, by adding modelling 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. [2] 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. [3] 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): [4]

classHelloWorld{publicstaticvoidmain(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. [4]

classPerson{name;// Attribute, string by defaultStringtoString(){return(getName());}}classStudent{isAPerson;}classMentor{isAPerson;}association{0..1Mentor--*Student;}classPerson{publicstaticvoidmain(String[]args){Mentorm=newMentor("Nick The Mentor");Students=newStudent("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. [5]

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 the Umple compiler was written in Java, Antlr and Jet (Java Emitter Templates), but in a bootstrapping process, the Java code was converted to Umple following a technique called Umplification. [6] The Antlr and Jet were also later converted to native Umple. Umple is therefore now written entirely in itself, in other words it is self-hosted and serves as its own largest test case.

Umple and UmpleOnline have been used in the classroom by several instructors to teach UML and modelling. 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. [7]

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 [8] , 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. [9]

See also

Related Research Articles

In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state and implementations of behavior.

In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters.

In computer programming, the strategy pattern is a behavioral software design pattern that enables selecting an algorithm at runtime. Instead of implementing a single algorithm directly, code receives run-time instructions as to which in a family of algorithms to use.

In object-oriented programming languages, a mixin is a class that contains methods for use by other classes without having to be the parent class of those other classes. How those other classes gain access to the mixin's methods depends on the language. Mixins are sometimes described as being "included" rather than "inherited".

<span class="mw-page-title-main">Apache Groovy</span> Programming language

Apache Groovy is a Java-syntax-compatible object-oriented programming language for the Java platform. It is both a static and dynamic language with features similar to those of Python, Ruby, and Smalltalk. It can be used as both a programming language and a scripting language for the Java Platform, is compiled to Java virtual machine (JVM) bytecode, and interoperates seamlessly with other Java code and libraries. Groovy uses a curly-bracket syntax similar to Java's. Groovy supports closures, multiline strings, and expressions embedded in strings. Much of Groovy's power lies in its AST transformations, triggered through annotations.

Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.

In computer programming, an entry point is the place in a program where the execution of a program begins, and where the program has access to command line arguments.

The Shlaer–Mellor method, also known as object-oriented systems analysis (OOSA) or object-oriented analysis (OOA) is an object-oriented software development methodology introduced by Sally Shlaer and Stephen Mellor in 1988. The method makes the documented analysis so precise that it is possible to implement the analysis model directly by translation to the target architecture, rather than by elaborating model changes through a series of more platform-specific models. In the new millennium the Shlaer–Mellor method has migrated to the UML notation, becoming Executable UML.

<span class="mw-page-title-main">Class diagram</span> Type of static structure diagram

In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations, and the relationships among objects.

<span class="mw-page-title-main">Scala (programming language)</span> General-purpose programming language

Scala is a strong statically typed high-level general-purpose programming language that supports both object-oriented programming and functional programming. Designed to be concise, many of Scala's design decisions are intended to address criticisms of Java.

Glossary of Unified Modeling Language (UML) terms provides a compilation of terminology used in all versions of UML, along with their definitions. Any notable distinctions that may exist between versions are noted with the individual entry it applies to.

In the Java computer programming language, an annotation is a form of syntactic metadata that can be added to Java source code. Classes, methods, variables, parameters and Java packages may be annotated. Like Javadoc tags, Java annotations can be read from source files. Unlike Javadoc tags, Java annotations can also be embedded in and read from Java class files generated by the Java compiler. This allows annotations to be retained by the Java virtual machine at run-time and read via reflection. It is possible to create meta-annotations out of the existing ones in Java.

Executable UML is both a software development method and a highly abstract software language. It was described for the first time in 2002 in the book "Executable UML: A Foundation for Model-Driven Architecture". The language "combines a subset of the UML graphical notation with executable semantics and timing rules." The Executable UML method is the successor to the Shlaer–Mellor method.

Object-oriented design (OOD) is the process of planning a system of interacting objects for the purpose of solving a software problem. It is one approach to software design.

Ragel is a finite-state machine compiler and a parser generator. Initially Ragel supported output for C, C++ and Assembly source code, and was expanded to support several other languages including Objective C, D, Go, Ruby, and Java. Additional language support is also in development. It supports the generation of table or control flow driven state machines from regular expressions and/or state charts and can also build lexical analysers via the longest-match method. Ragel specifically targets text parsing and input validation.

Static import is a feature introduced in the Java programming language that allows members which have been scoped within their container class as public static, to be used in Java code without specifying the class in which the field has been defined. This feature was introduced into the language in version 5.0.

<span class="mw-page-title-main">Applications of UML</span>

UML is a modeling language used by software developers. UML can be used to develop diagrams and provide users (programmers) with ready-to-use, expressive modeling examples. Some UML tools generate program language code from UML. UML can be used for modeling a system independent of a platform language. UML is a graphical language for visualizing, specifying, constructing, and documenting information about software-intensive systems. UML gives a standard way to write a system model, covering conceptual ideas. With an understanding of modeling, the use and application of UML can make the software development process more efficient.

Java bytecode is the instruction set of the Java virtual machine (JVM), crucial for executing programs written in the Java language and other JVM-compatible languages. Each bytecode operation in the JVM is represented by a single byte, hence the name "bytecode", making it a compact form of instruction. This intermediate form enables Java programs to be platform-independent, as they are compiled not to native machine code but to a universally executable format across different JVM implementations.

Kotlin is a cross-platform, statically typed, general-purpose high-level programming language with type inference. Kotlin is designed to interoperate fully with Java, and the JVM version of Kotlin's standard library depends on the Java Class Library, but type inference allows its syntax to be more concise. Kotlin mainly targets the JVM, but also compiles to JavaScript or native code via LLVM. Language development costs are borne by JetBrains, while the Kotlin Foundation protects the Kotlin trademark.

<span class="mw-page-title-main">Enterprise Architect (software)</span> Visual modeling and design tool

Sparx Systems Enterprise Architect is a visual modeling and design tool based on the OMG UML. The platform supports: the design and construction of software systems; modeling business processes; and modeling industry based domains. It is used by businesses and organizations to not only model the architecture of their systems, but to process the implementation of these models across the full application development life-cycle.

References

  1. "Official project website".
  2. 1 2 Forward, Andrew (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.
  3. Badreddin, Omar (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.
  4. 1 2 "Hello World Examples". Umple User Manual. 2013.
  5. "Basic State Machines". Umple User Manual. 2013.
  6. Lethbridge, Timothy C.; Forward, Andrew; Badreddin, Omar (2010). "Umplification: Refactoring to Incrementally Add Abstraction to a Program". 2010 17th Working Conference on Reverse Engineering. pp. 220–224. doi:10.1109/wcre.2010.32. ISBN   978-1-4244-8911-4. S2CID   14808702.
  7. Lethbridge, Timothy C.; Mussbacher, Gunter; Forward, Andrew; Badreddin, Omar (2011). "Teaching UML using umple: Applying model-oriented programming in the classroom". 2011 24th IEEE-CS Conference on Software Engineering Education and Training (CSEE&T). pp. 421–428. doi:10.1109/cseet.2011.5876118. ISBN   978-1-4577-0349-2. S2CID   15975894.
  8. CRuiSE group, University of Ottawa. "Umple Online".
  9. Forward, Andrew; Badreddin, Omar; Lethbridge, Timothy C.; Solano, Julian (July 2012). "Model-driven rapid prototyping with Umple". Software: Practice and Experience. 42 (7): 781–797. doi:10.1002/spe.1155. S2CID   36046547.