This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Improving Code Generation for Associations: Enforcing Multiplicity Constraints and Ensuring Referential Integrity
SERA 2013 (August 7, 2013 in Prague, Czech Republic)
Omar Badreddin, Andrew Forward, Timothy C. Lethbridge1 University of Ottawa
Symmetric Associations (between the same class)• Reads the same in both directions (e.g. spouse)
A total 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
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
16
Impr
ovin
g Co
de G
ener
ation
for A
ssoc
iatio
ns
class X { 0..1 -- * Y;}class Y {}
One Association-End
17
Impr
ovin
g Co
de G
ener
ation
for A
ssoc
iatio
ns
Many Association-End
18
Impr
ovin
g Co
de G
ener
ation
for A
ssoc
iatio
ns
Try For Yourself
19
Impr
ovin
g Co
de G
ener
ation
for A
ssoc
iatio
ns
http://try.umple.org
Academic Use Of Umple
20
Impr
ovin
g Co
de G
ener
ation
for A
ssoc
iatio
ns
Umple (metamodel.umple.org)
21
Impr
ovin
g Co
de G
ener
ation
for A
ssoc
iatio
ns
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)
• 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
29
Impr
ovin
g Co
de G
ener
ation
for A
ssoc
iatio
ns
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