SERA 2013
This presentation is the property of its rightful owner.
Sponsored Links
1 / 33

SERA 2013 (August 7, 2013 in Prague, Czech Republic) PowerPoint PPT Presentation


  • 60 Views
  • Uploaded on
  • Presentation posted in: General

SERA 2013 (August 7, 2013 in Prague, Czech Republic) Omar Badreddin, Andrew Forward, Timothy C. Lethbridge1 University of Ottawa [email protected] / [email protected] [email protected] / [email protected] [email protected] http:/ /umple.org.

Download Presentation

SERA 2013 (August 7, 2013 in Prague, Czech Republic)

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Sera 2013 august 7 2013 in prague czech republic

SERA 2013 (August 7, 2013 in Prague, Czech Republic)

Omar Badreddin, Andrew Forward, Timothy C. Lethbridge1

University of Ottawa

[email protected] / [email protected]

[email protected] / [email protected]

[email protected]

http://umple.org

Improving Code Generation for Associations: Enforcing Multiplicity Constraints and Ensuring Referential Integrity


Overview

Overview

Umple Philosophy (Quick Review)

Umple Association Syntax

Umplein Academia and Industry

Getting Involved

Future Work


Umple philosophy

Umple Philosophy

Improving Code Generation for Associations

Umple extends a base language in a minimally invasive way

Umple features can be created and viewed

diagrammatically or textually

=

Modeling is programming and vice versa

Intermediate generated code should not be edited

No round-trip engineering required


Defining association

Defining Association

  • Specification describing the links between objects that can exist at run time

  • Each end of the association has a multiplicity

    • Specifies upper and lower bound on the number of links

Improving Code Generation for Associations

class X {

0..1 -- * Y;

}

class Y {}

X can have many Y’s, and Y can optionally have one X.


Available multiplicities

Available Multiplicities

Optional One / One

Many / Star

Improving Code Generation for Associations


Umple association syntax

Umple Association Syntax

// Embed within the class

class X

{

0..1 -- *Y yonks;

}

class Y {}

// Or Define explicitly

class Z {}

associationm { * Z -> * Y; }

Supports all multiplicities,

e.g. 1, m..n, 1..*

Optionally name the association end for clearer intention as well as to support multiple associations between two classes.

To name an association (also optional) simply declare it explicitly as shown here.

Directed associations


Referential integrity

Referential Integrity

Either side of the relationship can be set, and the other will automatically be maintained, so

x.addY(y) equivalent to y.setX(x)

If either side removes a relationship, then the other side will automatically be removed as well, so

y.setX(x1); // x1 associated with y

y.setX(x2); // x1 unassociated with y


Multiplicity constraint

Multiplicity Constraint

Set / Add / Remove might fail (returns a false) if the multiplicity is not supported

Multiplicities also affect relationship (e.g. setting Y to a new X, removes the old relationship because of the 0..1 multiplicity)


Associations in practice

Associations In Practice

Too difficult to identify associations with any degree of certainty by looking only at the source code

Difficulty with which we had trying to identify the use of association in code served as a motivation in itself


Analyzed models instead

Analyzed Models Instead

  • 1400 Industry examples by looking at UML specs and UML profiles

    • UML v1.5

    • UML v2.1.2

    • MARTE, Flow Composition, ECA, Java, Patterns, rCOS

  • 98 Example models from a course textbook of one of the authors

  • 250 Repository models from the collection of models codified in Umple


Multiplicity rankings in industrial models

Multiplicity Rankings inIndustrial Models

Improving Code Generation for Associations

One To Many Most Used In All Sources

Very few non one or many ends


Multiplicity rankings in example textbook models

Multiplicity Rankings inExample / Textbook Models

Improving Code Generation for Associations


Multiplicity rankings in uml repositories

Multiplicity Rankings inUML Repositories

Improving Code Generation for Associations

UML Repository viewable at http://try.umple.org


Code generation for associations in existing tools

Code Generation for Associations in Existing Tools

Improving Code Generation for Associations

  • All similar implementations, member variables for One multiplicities and List variables for Many

  • Little to no referential integrity

  • Little to no multiplicity constraints


Association combinations

Association Combinations

Bi-Directional Associations (between different classes)

  • Atotal of 42 different possible association types have been identified

  • 28 for bidirectional associations

  • 7 for unidirectional associations

  • 7 for symmetric associations

  • Each case explicitly handled, with code re-use where possible

Improving Code Generation for Associations

  • Directed Associations

    * -> 0..1; -> 1; -> *; -> m..n; -> n; -> m..*; -> 0..n

    Symmetric Associations (between the same class)

  • Reads the same in both directions (e.g. spouse)


Association code generation

Association Code Generation

  • Member variables for One

  • List variables for Many

  • Referential Integrity maintained

    • E.g. a student switches mentors

  • Multiplicity Constraints enforced

    • E.g. cannot overload a mentor

class X {

0..1 -- * Y;

}

class Y {}


One association end

One Association-End


Many association end

Many Association-End


Try for yourself

Try For Yourself

http://try.umple.org


Sera 2013 august 7 2013 in prague czech republic

Improving Code Generation for Associations

Academic Use Of Umple


Umple metamodel umple org

Umple(metamodel.umple.org)

Improving Code Generation for Associations


Teaching umple

Teaching Umple

  • University of Ottawa, Canada

    • Second year Introduction to Software Engineering

    • Fourth year Advanced Design

    • Other professors, including at graduate level

    • SCORE finalists at ICSE 2011

  • UCOSP (Undergraduate Capstone Open Source Project)

Improving Code Generation for Associations


Sera 2013 august 7 2013 in prague czech republic

Improving Code Generation for Associations

Industry Examples


Hatchmortgage com

hatchmortgage.com

Improving Code Generation for Associations


Alms arrowmight ca

alms.arrowmight.ca

Improving Code Generation for Associations


Arm arrowmight ca

arm.arrowmight.ca

Improving Code Generation for Associations


Http cruise eecs uottawa ca umpleonline iframeexample html

Improving Code Generation for Associations

Embed Models In HTML

http://cruise.eecs.uottawa.ca/umpleonline/iframeexample.html


Sera 2013 august 7 2013 in prague czech republic

<html>

<head><title>My Example</title></head>

<body>

<p>

<iframe height=550 width=100% frameborder="0" scrolling="auto" src="http://try.umple.org/umple.php?example=2DShapes&readOnly&notext&nomenu&nochrome"><p>No iframe support</p></iframe>

</p>

<p>

<iframe height=550 width=100% frameborder="0" scrolling="auto" src="http://try.umple.org/umple.php?example=2DShapes&readOnly&nodiagram&nomenu&nochrome"><p>No iframe support</p></iframe>

</p>

</body>

</html>

Improving Code Generation for Associations


Current and future work

Current and Future Work

  • Umplification

    • Starting with OO code, incrementally add modeling abstractions

    • Maintain system functionality throughout the process

    • Using existing code repositories

    • Reduce code size

  • Model Based Tracing

    • Define tracing directive at the model level

  • Aspect Orientation

  • Additional Refactoring on Umple itself

Improving Code Generation for Associations


Getting involved

Getting Involved

  • Open source project: https://code.google.com/p/umple/

  • 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

  • Rapid system prototyping

    Comments and feedback: [email protected]

Improving Code Generation for Associations


More information

More information

Publications on Umple: https://code.google.com/p/umple/wiki/Publications

The User Manual: http://cruise.eecs.uottawa.ca/umple/GettingStarted.html

Umple Home page: http://cruise.eecs.uottawa.ca/umple/

Download Umple: http://cruise.eecs.uottawa.ca/umpleonline/download_eclipse_umple_plugin.html

Report an issue: https://code.google.com/p/umple/issues/entry


Summary

Summary

  • 42 unique ways to define an association between one or two

  • In practice, mostly One or Many, but mostly does not mean always

  • Implemented referential integrity and multiplicity constraints for each unique combination

    • Test-Driven approach to reduce regressions

    • Important as new features are added to the languagethe help reduce code clones

  • Many additional features available in Umple including tracing, state machines, code injections, mixin

  • More coming including better support for aspect orientation


  • Login