OCL in a small nutshell - PowerPoint PPT Presentation

About This Presentation
Title:

OCL in a small nutshell

Description:

(syntatical checking on class diagrams, cool editor and generates java code!) http://www.klasse.nl/english/research/octopus-intro.html. OCLE: ... – PowerPoint PPT presentation

Number of Views:94
Avg rating:3.0/5.0
Slides: 14
Provided by: Jair1
Category:
Tags: ocl | cool | effects | html | nutshell

less

Transcript and Presenter's Notes

Title: OCL in a small nutshell


1
OCL in a small nutshell
  • Jairson Vitorino, Cin UFPE
  • May, 2nd 2005

2
Contents
  • Motivation
  • What is OCL?
  • Uses of OCL
  • Examples
  • References

3
Motivation
  • Are you serious about your UML models?
  • (source www.empowertec.de)

4
What is OCL?
  • The Object Constraint Language (OCL) is a query
    language that can be used to define expressions
    on object oriented models (UML).
  • OCL enrich the models with unambiguous
    information, formalizing knowledge about the
    underlying business domain.

5
It is a formal language, but Yes! You can
understand it and even use it!
6
Uses of OCL
  • Constraints are the most prominent use.
  • Initialization expressions can be used to specify
    an initial value for an attribute or an
    association.
  • OCL expressions can be used to specify the
    algorithm that is to be used for derived
    attributes, i.e. values that are calculated from
    other attributes or associations.
  • OCL expressions can be used to specify the
    implementation of methods as long as they do not
    have side effects (i.e. the method is 'read
    only').

7
A trivial Example
optional
You can refer to the previous state of na object
context Stackpop() Object pre notEmpty
isEmpty() false post topElementReturned
result self_at_pre.top() post topElementRemoved
top() ltgt self_at_pre.top()   context Stacktop()
Object pre notEmpty isEmpty() false  
context Stackpush(anObject Object) void
post pushedObjectIsOnTop top() anObject
8
A more typical example
9
And typical constraints...
No employee may be older than 65 years
OCL equivalent
context Company inv self.employee-gtforAll(age lt
65)
And what about this one? What does it mean?
context Company inv employee-gtexists(isUnemploye
d) false
10
More examples in the PDF
11
Tools
  • Octopus Plug-in for Eclipse
  • (syntatical checking on class diagrams, cool
    editor and generates java code!)
    http//www.klasse.nl/english/research/octopus-intr
    o.html
  • OCLE
  • From Romenia, syntantical checking, model
    checking, comes with full UML meta-model and
    well-formdness rules for diagrams consistency in
    OCL! Generates java code) http//lci.cs.ubbcluj.ro
    /ocle/overview.htm
  • OCL-AddIn for Rational Rose, similar to Octopus
    but do not generate code.
  • http//www.empowertec.de/products/rational-rose-oc
    l.htm

12
Conclusions and further motivation
  • UML without OCL is only useful for extreme
    programming, disposable models
  • OCL is key for formal methods, UML models as
    first-class, strategic, reusable artefacts and
    (future) automated code generation

13
References
  • http//www.omg.org
  • http//www.empowertec.de
  • Presentation Object Constraint Language (OCL) by
    Tevfik Bultan (www.cs.ucsb.edu/bultan/courses/272
    /OCL.ppt)
  • Introduction to OCL, Andreas Roth
  • (i12www.ira.uka.de/aroth/ lehre/keypraktWS0304/oc
    lIntro.pdf)
Write a Comment
User Comments (0)
About PowerShow.com