UML is still inconsistent! How to im prove OCL Constraints in the - - PowerPoint PPT Presentation

uml is still inconsistent
SMART_READER_LITE
LIVE PREVIEW

UML is still inconsistent! How to im prove OCL Constraints in the - - PowerPoint PPT Presentation

Departm ent of Com puter Science Institute for Software and Multimedia Engineering, Software Technology Group UML is still inconsistent! How to im prove OCL Constraints in the UML 2 .3 Superstructure Claas Wilke and Birgit Demuth OCL 2011


slide-1
SLIDE 1

UML is still inconsistent!

How to im prove OCL Constraints in the UML 2 .3 Superstructure Claas Wilke and Birgit Demuth

Departm ent of Com puter Science Institute for Software and Multimedia Engineering, Software Technology Group

OCL 2011 Zurich, June 29th 2011

slide-2
SLIDE 2

Motivation

  • OCL usage w ithin the UML specification
  • Definition of constraints
  • Definition of addititonal operations
  • W hen UML w as originally specified, no OCL tooling existed

→ OCL rules where specified manually („by hand“) → No checks of syntax and static semantics

  • I nvestigations on UML/ OCL inconsistency
  • UML 2.0: 361 errors in 246 OCL rules [ BGG04]
  • UML 1.5: 450 errors [ FQL+ 03]
  • UML 1.3: 39 errors in 71 OCL rules [ RG00]
  • This w ork
  • Today‘s situation (UML 2.3)?
  • How can similar problems avoided for future specifications?

Zurich, June 29th 2011 UML is still inconsistent! Slide 2

slide-3
SLIDE 3

Methodology (1/ 2)

Zurich, June 29th 2011 UML is still inconsistent! Slide 3

UML 2.3 Superstructure MDT UML 2.3 Metamodel copy / paste import Dresden OCL Parser/ Editor errors / warnings manual investigation / modification / classification Project online at http:/ / w w w .dresden-ocl.org/ index.php/ DresdenOCL:W FRsI nUML

slide-4
SLIDE 4

Methodology (2/ 2)

  • Only OCL expressions from constraints sections investigated
  • Additional operations (body expressions) ignored
  • Context declarations were added manually
  • Textual constraints w ere counted
  • Neither transformed into OCL
  • Nor checked if that is possible at all
  • Erroneous constraints w ere fixed w here possible
  • Sam e error occuring m ultiple tim es in one constraint
  • Counted as one error

Zurich, June 29th 2011 UML is still inconsistent! Slide 4

slide-5
SLIDE 5

Results

  • 4 6 .8 % of all constraints have no OCL sem antics!
  • 4 8 .5 % of all OCL rules are erroneous!

Zurich, June 29th 2011 UML is still inconsistent! Slide 5

General Statistics

slide-6
SLIDE 6

Results

  • Total: 3 2 0 errors
  • Classified into 1 4 types of five categories

Zurich, June 29th 2011 UML is still inconsistent! Slide 6

Different Types of Errors

slide-7
SLIDE 7

Results

1 . Typing Errors 15 (6.4 % ) 2 . Brackets 27 (11.5 % ) 3 . W rong I fs 8 (3.4 % ) 4 . Missing Escape 14 (6.0 % ) 5 . W rong use of # 6 (2.6 % ) 6 . W rong use of -> / . 9 (3.8 % )

Zurich, June 29th 2011 UML is still inconsistent! Slide 7

Syntactical Errors

slide-8
SLIDE 8

Results

1 . W rong Nam edElem ent Referred 62 (26.4 % ) 2 . Operation vs. Property Call 9 (3.8 % )

Zurich, June 29th 2011 UML is still inconsistent! Slide 8

Minor I nconsistencies

slide-9
SLIDE 9

3 . Missing asSet( ) 15 (6.4 % ) 4 . Missing asOrderedSet( ) 9 (3.8 % ) 1 . Result Type 20 (8.5 % ) 2 . W rong I terator 4 (1.7 % )

Results

Zurich, June 29th 2011 UML is still inconsistent! Slide 9

Type Checking Errors

slide-10
SLIDE 10

1 . Enum eration Literals 54 (23.0 % ) 2 . Set{ } vs. null 16 (6.8 % )

Results

Zurich, June 29th 2011 UML is still inconsistent! Slide 10

Evolution Errors

slide-11
SLIDE 11

1 . I m plicit asSet 94 2 . I m plicit collect 18

Results

Zurich, June 29th 2011 UML is still inconsistent! Slide 11

I m plicit Conversions

slide-12
SLIDE 12
  • The OCL rule quality has not been im proved since [ BBG0 4 ] !
  • The current specification approach is insufficient
  • 1. No syntactical checks
  • 2. No static semantics checks
  • 3. No dynamic semantic checks
  • 4. No Support for UML/ OCL coevolution
  • Proposed specification im provem ents
  • 1. Model-Based Specification process
  • 2. Elucidative Specification
  • 3. Use of OCL unit testing
  • 4. Use of UML/ OCL coevolution tools
  • Proposed OCL im provem ents
  • 1. Removal of -> operator
  • 2. Avoidance of implicit conversions
  • 3. Introduction of selectByKind()

Lessons Learnt

Zurich, June 29th 2011 UML is still inconsistent! Slide 12

slide-13
SLIDE 13

[ WBS+ 11]

Possible Improvements

Zurich, June 29th 2011 UML is still inconsistent! Slide 13

Elucidative Specification

slide-14
SLIDE 14
  • The -> operator for collection operations is irritating
  • Even authors of UML do not know how to use it
  • Using w rong operators is dangerous
  • Different semantics
  • Unnecessary conversions

→ Use . for collection operations as w ell

Possible Improvements

Zurich, June 29th 2011 UML is still inconsistent! Slide 14

Rem oval of the -> operator

slide-15
SLIDE 15
  • I m plicit conversions often occur unforeseen
  • Dangerous and unnecessary com binations possible

→ They should be avoided, if not forbidden

Possible Improvements

Zurich, June 29th 2011 UML is still inconsistent! Slide 15

Avoid im plicit asSet and im plicit collect

slide-16
SLIDE 16

Summary

  • I nvestigation of OCL rules defined in UML
  • 53.2 constraints do not define any OCL rules
  • 48.5% of all OCL rules contain errors
  • Many errors could be avoided
  • Improved specification process
  • Modifications of the OCL
  • Future W ork
  • Do other specifications have the same problems?
  • Are proposed improvements applicable
  • How did existing UML implementations solved the OCL errors?

Zurich, June 29th 2011 UML is still inconsistent! Slide 16

slide-17
SLIDE 17

Literature (1/ 2)

[ BGG04] H. Bauerdick, M. Gogolla, F. Gutsche. Detecting OCL Traps in the UML 2.0 Superstructure: An Experience Report. In: UML 2004 - The Unified Modeling Language. LNCS 3273, pp. 188-196. Springer Berlin / Heidelberg, 2004. [ FQL+ 03] J. Fuentes, V. Quintana, J. Llorens, G. Genova,

  • R. Prieto-Daz. Errors in the UML metamodel? ACM SIGSOFT

Software Engineering Notes 28(6), 2003. [ RG00]

  • M. Richters, M. Gogolla. Validating UML Models and OCL
  • Constraints. In: Proceedings of the 3rd international

conference on The unified modeling language: advancing the standard, pp. 265-277. Springer Berlin / Heidelberg, 2000. [ CO09]

  • J. Chimiak-Opoka. OCLLib, OCLUnit, OCLDoc: Pragmatic

Extensions for the Object Constraint Language. In: Model Driven Engineering Languages and Systems. LNCS 5795,

  • pp. 665–669. Springer Berlin / Heidelberg, 2009.

Zurich, June 29th 2011 UML is still inconsistent! Slide 17

slide-18
SLIDE 18

Literature (2/ 2)

[ HG10]

  • L. Hamann, M. Gogolla. Improving Model Quality by

Validating Constraints with Model Unit Tests. In: Proceedings

  • f the Models Workshop on Model-Driven Enginering,

Verification and Validation (MoDeVVa2010). 2010. [ WBS+ 11] C. Wilke, A. Bartho, J. Schroeter, S. Karol, U. Aßmann. Elucidative Specification of the Unified Modeling Language. Submitted for the ACM/ IEEE 14th International Conference

  • n Model Driven Engineering Languages and Systems

(MODELS 2011), Wellington, New Zealand, October 16 - 21, 2011.

Zurich, June 29th 2011 UML is still inconsistent! Slide 18

slide-19
SLIDE 19

Thank you!

Dresden OCL http:/ / w w w .dresden-ocl.org/ Softw are Technology Group http:/ / st.inf.tu-dresden.de/ QualiTune http:/ / w w w . qualitune.org/ claas.w ilke@tu-dresden.de

Zurich, June 29th 2011 UML is still inconsistent! Slide 19

slide-20
SLIDE 20

Backup

Zurich, June 29th 2011 UML is still inconsistent! Slide 20

slide-21
SLIDE 21

Results

→ Most OCL rules are rather sim ple

Zurich, June 29th 2011 UML is still inconsistent! Slide 21

OCL Rule Com plexity ( structure)

slide-22
SLIDE 22
  • Testing OCL constraints is sensible
  • Do they constrain what they shall constrain?
  • Checks for runtime errors (invalid values)

E.g., division by zero

  • OCL testing facilities exist
  • [ CO09] , [ HG10]
  • Unit tests could be deployed together w ith the specification
  • Regression/ acceptance tests for UML case tools

Possible Improvements

Zurich, June 29th 2011 UML is still inconsistent! Slide 22

OCL Unit Testing

slide-23
SLIDE 23
  • A select is often follow ed by a cast
  • Filter → Cast
  • Requires two iterations → overhead
  • I ntroduction of a selectByKind iterator

→ Only one iteration remaining

  • And even more readable

Possible Improvements

Zurich, June 29th 2011 UML is still inconsistent! Slide 23

I ntroduction of selectByKind iterator