SlideShare a Scribd company logo
Made available under EPL 1.0
Safe Navigation in OCL
Edward Willink
Willink Transformations Ltd
Eclipse Foundation
MMT Component co-Lead
OCL Project Lead
QVTd Project Lead
QVTo Committer
OMG (Model Driven Solutions)
OCL 2.3, 2.4, 2.5 RTF Chair
QVT 1.2, 1.3 RTF Chair
OCL 2015 @ MODELS 2015
28th September 2015
28-Sept-2015 Safe Navigation in OCL 2Made available under EPL 1.0
Overview
The null navigation problem
Inadequate solution
"?." and "?->" safe counter parts to "." and "->"
Viable solution
non-null object declarations
null-free collection declarations
...
28-Sept-2015 Safe Navigation in OCL 3Made available under EPL 1.0
null
C.A.R.Hoare 2009
"I call it my billion-dollar mistake. It was the invention of the null
reference in 1965. At that time, I was designing the first
comprehensive type system for references in an object oriented
language (ALGOL W). My goal was to ensure that all use of
references should be absolutely safe, with checking performed
automatically by the compiler."
a good goal for OCL
"But I couldn't resist the temptation to put in a null reference, simply
because it was so easy to implement. This has led to innumerable
errors, vulnerabilities, and system crashes, which have probably
caused a billion dollars of pain and damage in the last forty years."
ignored in OCL for too long
OCL is broken
28-Sept-2015 Safe Navigation in OCL 4Made available under EPL 1.0
null in OCL
null has many, but not all, object characteristics
use of a missing characteristic crashes
aPerson.father.name.toUpper()
obviously fails if aPerson is null
fails if a father is null
inevitable in a finite model
fails if a name is null
quite possible in an incomplete model
DATA DEPENDENT RUN-TIME FAILURE
and we think OCL is a better language
28-Sept-2015 Safe Navigation in OCL 5Made available under EPL 1.0
Cures
Strong declarations
C++ references: int&
works
Java annotations: @NonNull Integer
fails on unannotated system/library/framework code
Safe navigation operator
Groovy, Python, Xbase my?.name
pushes problem sideways
Mitigation
28-Sept-2015 Safe Navigation in OCL 6Made available under EPL 1.0
OCL Safe Navigation Operators 1
Safe Object Navigation Operator
x?.y
shortform for
if x <> null then x.y else null endif
Safe Collection Navigation Operator
x?->y
shortform for
x->excluding(null)->y
28-Sept-2015 Safe Navigation in OCL 7Made available under EPL 1.0
OCL Safe Navigation Operators 2
null hazards can be avoided
aPerson.children.name->toUpper()
aPerson?.children?.name?->toUpper()
ugly
4 rather than 2 operators to confuse novices
need tooling
28-Sept-2015 Safe Navigation in OCL 8Made available under EPL 1.0
Safe Navigation Operator WFRs
Error: Safe Navigation Required. a.b
If the source could be null, a safe navigation
operator should be used to avoid a run-time hazard.
Warning: Safe Navigation not Required. a?.b
If the source cannot be null, a safe navigation
operator is unnecessary and may incur overheads.
How do we determine could be null for OCL?
28-Sept-2015 Safe Navigation in OCL 9Made available under EPL 1.0
Non-Null Objects
Constants
4
Set{42}
Constant Expressions
if ... then Set{42} else Set{} endif
But objects are rather useful
if self = x then y else z endif
28-Sept-2015 Safe Navigation in OCL 10Made available under EPL 1.0
Non-Null Object Declarations
New syntax - e.g. C++ references
UML syntax
optionalName : String[?]
mandatoryName : String[1]
[?] String value is optional; null value is permitted.
[1] String value is required; null value is prohibited.
[*], [+], [2..5] etc not appropriate for single Object
OCL extension
let/iterator variable types may have a multiplicity
let name : String[1] = ... in ...
someNames->forAll(name : String[?] | ...)
OCL legacy default is [?], UML default is [1]
28-Sept-2015 Safe Navigation in OCL 11Made available under EPL 1.0
Non-Null collection elements
Collections are a very important part of OCL
OCL: Collections can contain null elements
in practice very few do
OCL: Any iterator variable may be null
in practice iterator variables are non-null
Major inconsistency between OCL and practice
28-Sept-2015 Safe Navigation in OCL 12Made available under EPL 1.0
Null-Free Collections
New syntax / Extended UML syntax
UML-alignment requires bounded collections
Sequence(Integer)[1..2]
one or two element sequence
Sequence(Sequence(Real)[3])[3]
3x3 matrix
OCL extension collection | element multiplicity
Set(String)[+|1]
collection multiplicity: + => one or more
element multiplicity: 1 => non-null => null-free collection
28-Sept-2015 Safe Navigation in OCL 13Made available under EPL 1.0
Null-Free Collection Example
28-Sept-2015 Safe Navigation in OCL 14Made available under EPL 1.0
Null-Safe Libraries - Simple
OCL Standard Library should be modeled
planned for OCL 2.5/3.0, prototyped in Eclipse OCL
semi-formal declarations
String::toBoolean() : Boolean
post: result = (self = 'true')
pessimistically
String::toBoolean() : Boolean[?]
after analysis of post-conditon
String::toBoolean() : Boolean[1]
28-Sept-2015 Safe Navigation in OCL 15Made available under EPL 1.0
Null-Safe Libraries - Complex 1
OCL 2.4: Set::including(object : T) : Set(T)
vague
is source T same as argument/result T?
how are derived types resolved?
Java analogy inappropriate
Set(E)::add(E) : boolean
Set is mutable, no creation, no type change
OCL Set is immutable, new instance/type for result
Clearer: Set(T)::including(object : T) : Set(T)
All T's exist in library
Choose the most derived T
28-Sept-2015 Safe Navigation in OCL 16Made available under EPL 1.0
Null-Safe Libraries - Complex 2
Set(T)[*|e1]::including(object : T[e2]) : Set(T)[*|e3]
Informally: result is null-free if
source is null-free and argument object is non-null
Formally:
null-free = true
non-null = true
e3 = e1 and e2
Pessimistic static modeled definitions
28-Sept-2015 Safe Navigation in OCL 17Made available under EPL 1.0
Null-Safe Libraries - Complex 3
Set(T)[c1|e1]::including(object : T[e2]) : Set(T)[c3|e3]
Pessimitic, very simple
multiplicity is always 0 to unlimited.
c1.lower = 0, c1.upper=*, c3.lower = 0, c3.upper = *
Pessimitic, more accurate
c3.lower = c1.lower
c3.upper = if c1.upper = * then * else c1.upper+1 endif
Null-safety requires element multiplicity modeling
collection multiplicity modeling is comparable
28-Sept-2015 Safe Navigation in OCL 18Made available under EPL 1.0
Null-Safe User Models
RoyalAndLoyal.ocl shows numerous errors
RoyalAndLoyal.ecore inaccurate
Kleppe & Warmer UML diagrams specify [1]
Ecore has [?] defaults
Fixing RoyalAndLoyal.ecore fixes Object problems
But all Collection/Iterator problems remain
add null-free EAnnotations
28-Sept-2015 Safe Navigation in OCL 19Made available under EPL 1.0
OCL Collection Stereotypes
UML has no null-free Collection support
fixable with a MultiplicityElement stereotype
one fix per stereotyped MultiplicityElement
OCL legacy - null-full collections
OCL practice - null-free collections
fixable with a Class or Package stereotype
changed defauly throughout Class / Package
28-Sept-2015 Safe Navigation in OCL 20Made available under EPL 1.0
OCLforUML Profile
(MultiplicityElement) Collection::isNullFree
(Class or Package) Collections::isNullFree
(InstanceSpecification) Validation::validate
(Package) Validations::validate
(DataType) Integer::maximum / minimum
... BoundedInteger ... Overflow
(DataType) Real::maximum / minimum / epsilon
... FixedPoint, FloatingPoint ... Bits ... Rounding
28-Sept-2015 Safe Navigation in OCL 21Made available under EPL 1.0
Deep Non-Null Analysis
let anObject : NamedElement[?] = ....
in anObject <> null implies anObject.name <> null
Variable declarations give pessimistic safety
anObject : NamedElement[?] implies anObject.name unsafe
Deeper analysis needed
total analysis impractical
simple implies/and/or practical
TBD: defined in OCL in OCL specification
28-Sept-2015 Safe Navigation in OCL 22Made available under EPL 1.0
Experience Report
Available in Eclipse Mars release (June 2015)
optional error/warning/ignore severity
Two non-trivial Complete OCL documents
change ignore severity to warning
numerous diagnostics - depressing
add safe navigation operators
hard work - wrong
correct user model declarations
stronger design - success
28-Sept-2015 Safe Navigation in OCL 23Made available under EPL 1.0
Summary
OCL is seriously unsafe null-wise
Naive safe navigation operators confusing
Intelligent Analysis tooling requires
non-null object declarations: [?]/[1] multiplicity
null-free collection declarations: [...|1] multiplicity
null-safe library collection declarations
Prototype available in Eclipse OCL (June 2015)

More Related Content

What's hot

Introduction to RxJava on Android
Introduction to RxJava on AndroidIntroduction to RxJava on Android
Introduction to RxJava on AndroidChris Arriola
 
A Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIA Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIJörn Guy Süß JGS
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java WorkshopSimon Ritter
 
Java.util.concurrent.concurrent hashmap
Java.util.concurrent.concurrent hashmapJava.util.concurrent.concurrent hashmap
Java.util.concurrent.concurrent hashmapSrinivasan Raghvan
 
Cilk - An Efficient Multithreaded Runtime System
Cilk - An Efficient Multithreaded Runtime SystemCilk - An Efficient Multithreaded Runtime System
Cilk - An Efficient Multithreaded Runtime SystemShareek Ahamed
 
The Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidThe Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidFernando Cejas
 
Deterministic Lazy Mutable OCL Collections
Deterministic Lazy Mutable OCL CollectionsDeterministic Lazy Mutable OCL Collections
Deterministic Lazy Mutable OCL CollectionsEdward Willink
 
Software Transactioneel Geheugen
Software Transactioneel GeheugenSoftware Transactioneel Geheugen
Software Transactioneel GeheugenDevnology
 
Reactive Android: RxJava and beyond
Reactive Android: RxJava and beyondReactive Android: RxJava and beyond
Reactive Android: RxJava and beyondFabio Tiriticco
 
Jfokus functional groovy
Jfokus functional groovyJfokus functional groovy
Jfokus functional groovyAndres Almiray
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJavaJobaer Chowdhury
 
(chapter 5) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 5) A Concise and Practical Introduction to Programming Algorithms in...(chapter 5) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 5) A Concise and Practical Introduction to Programming Algorithms in...Frank Nielsen
 
Re-engineering Eclipse MDT/OCL for Xtext
Re-engineering Eclipse MDT/OCL for XtextRe-engineering Eclipse MDT/OCL for Xtext
Re-engineering Eclipse MDT/OCL for XtextEdward Willink
 

What's hot (20)

Introduction to RxJava on Android
Introduction to RxJava on AndroidIntroduction to RxJava on Android
Introduction to RxJava on Android
 
A Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIA Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its API
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Java.util.concurrent.concurrent hashmap
Java.util.concurrent.concurrent hashmapJava.util.concurrent.concurrent hashmap
Java.util.concurrent.concurrent hashmap
 
Lambdas HOL
Lambdas HOLLambdas HOL
Lambdas HOL
 
Java 8 stream and c# 3.5
Java 8 stream and c# 3.5Java 8 stream and c# 3.5
Java 8 stream and c# 3.5
 
Cilk - An Efficient Multithreaded Runtime System
Cilk - An Efficient Multithreaded Runtime SystemCilk - An Efficient Multithreaded Runtime System
Cilk - An Efficient Multithreaded Runtime System
 
RxJava@Android
RxJava@AndroidRxJava@Android
RxJava@Android
 
The Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on AndroidThe Mayans Lost Guide to RxJava on Android
The Mayans Lost Guide to RxJava on Android
 
Python to scala
Python to scalaPython to scala
Python to scala
 
Deterministic Lazy Mutable OCL Collections
Deterministic Lazy Mutable OCL CollectionsDeterministic Lazy Mutable OCL Collections
Deterministic Lazy Mutable OCL Collections
 
Software Transactioneel Geheugen
Software Transactioneel GeheugenSoftware Transactioneel Geheugen
Software Transactioneel Geheugen
 
Reactive Android: RxJava and beyond
Reactive Android: RxJava and beyondReactive Android: RxJava and beyond
Reactive Android: RxJava and beyond
 
Jfokus functional groovy
Jfokus functional groovyJfokus functional groovy
Jfokus functional groovy
 
Java 8 new features
Java 8 new featuresJava 8 new features
Java 8 new features
 
Link quries
Link quriesLink quries
Link quries
 
Kotlin Overview
Kotlin OverviewKotlin Overview
Kotlin Overview
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJava
 
(chapter 5) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 5) A Concise and Practical Introduction to Programming Algorithms in...(chapter 5) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 5) A Concise and Practical Introduction to Programming Algorithms in...
 
Re-engineering Eclipse MDT/OCL for Xtext
Re-engineering Eclipse MDT/OCL for XtextRe-engineering Eclipse MDT/OCL for Xtext
Re-engineering Eclipse MDT/OCL for Xtext
 

Viewers also liked

Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...Edward Willink
 
Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...
Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...
Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...Valerio Cosentino
 
Wherecamp Navigation Conference 2015 - Going the safe way
Wherecamp Navigation Conference 2015 - Going the safe wayWherecamp Navigation Conference 2015 - Going the safe way
Wherecamp Navigation Conference 2015 - Going the safe wayWhereCampBerlin
 
Uml Omg Fundamental Certification 1
Uml Omg Fundamental Certification 1Uml Omg Fundamental Certification 1
Uml Omg Fundamental Certification 1Ricardo Quintero
 
IALA Buoyage System and Visual Aids to Navigation
IALA Buoyage System and Visual Aids to NavigationIALA Buoyage System and Visual Aids to Navigation
IALA Buoyage System and Visual Aids to NavigationLearnmarine
 
OCL Specification Status
OCL Specification StatusOCL Specification Status
OCL Specification StatusEdward Willink
 
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...OCCIware
 
Ressource numérique Circuit électrique au primaire
Ressource numérique Circuit électrique au primaire Ressource numérique Circuit électrique au primaire
Ressource numérique Circuit électrique au primaire Erradi Mohamed
 
The Importance of Opposites
The Importance of OppositesThe Importance of Opposites
The Importance of OppositesEdward Willink
 
01072013 e governance
01072013 e governance01072013 e governance
01072013 e governancebharati k
 
النشاط العلمي - الكهرباء
النشاط العلمي  -   الكهرباءالنشاط العلمي  -   الكهرباء
النشاط العلمي - الكهرباءErradi Mohamed
 

Viewers also liked (20)

Eclipse OCL Summary
Eclipse OCL SummaryEclipse OCL Summary
Eclipse OCL Summary
 
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
Local Optimizations in Eclipse QVTc and QVTr using the Micro-Mapping Model of...
 
Ocl exercises 1
Ocl exercises 1Ocl exercises 1
Ocl exercises 1
 
OCL tutorial
OCL tutorial OCL tutorial
OCL tutorial
 
Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...
Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...
Extracting UML/OCL Integrity Constraints and Derived Types from Relational Da...
 
Wherecamp Navigation Conference 2015 - Going the safe way
Wherecamp Navigation Conference 2015 - Going the safe wayWherecamp Navigation Conference 2015 - Going the safe way
Wherecamp Navigation Conference 2015 - Going the safe way
 
2015 IBWSS Presentation: BoatOnCourse.com: The Sequel
2015 IBWSS Presentation: BoatOnCourse.com: The Sequel2015 IBWSS Presentation: BoatOnCourse.com: The Sequel
2015 IBWSS Presentation: BoatOnCourse.com: The Sequel
 
Uml Omg Fundamental Certification 1
Uml Omg Fundamental Certification 1Uml Omg Fundamental Certification 1
Uml Omg Fundamental Certification 1
 
Aids To Navigation
Aids To NavigationAids To Navigation
Aids To Navigation
 
IALA Buoyage System and Visual Aids to Navigation
IALA Buoyage System and Visual Aids to NavigationIALA Buoyage System and Visual Aids to Navigation
IALA Buoyage System and Visual Aids to Navigation
 
OCL Specification Status
OCL Specification StatusOCL Specification Status
OCL Specification Status
 
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
 
Ressource numérique Circuit électrique au primaire
Ressource numérique Circuit électrique au primaire Ressource numérique Circuit électrique au primaire
Ressource numérique Circuit électrique au primaire
 
Mix
MixMix
Mix
 
OCCIware
OCCIwareOCCIware
OCCIware
 
The Importance of Opposites
The Importance of OppositesThe Importance of Opposites
The Importance of Opposites
 
Java vs .Net
Java vs .NetJava vs .Net
Java vs .Net
 
01072013 e governance
01072013 e governance01072013 e governance
01072013 e governance
 
النشاط العلمي - الكهرباء
النشاط العلمي  -   الكهرباءالنشاط العلمي  -   الكهرباء
النشاط العلمي - الكهرباء
 
OCL 2.5 plans
OCL 2.5 plansOCL 2.5 plans
OCL 2.5 plans
 

Similar to Safe navigation in OCL

Enriching your models with OCL
Enriching your models with OCLEnriching your models with OCL
Enriching your models with OCLUniversity of York
 
OCL 2019 Keynote Retrospective and Prospective
OCL 2019 Keynote Retrospective and ProspectiveOCL 2019 Keynote Retrospective and Prospective
OCL 2019 Keynote Retrospective and ProspectiveEdward Willink
 
O caml2014 leroy-slides
O caml2014 leroy-slidesO caml2014 leroy-slides
O caml2014 leroy-slidesOCaml
 
OCL - The Bigger Picture
OCL - The Bigger PictureOCL - The Bigger Picture
OCL - The Bigger PictureEdward Willink
 
The End of the world as we know it - AKA your last NullPointerException $1B b...
The End of the world as we know it - AKA your last NullPointerException $1B b...The End of the world as we know it - AKA your last NullPointerException $1B b...
The End of the world as we know it - AKA your last NullPointerException $1B b...Michael Vorburger
 
Modeling the OCL Standard Library
Modeling the OCL Standard LibraryModeling the OCL Standard Library
Modeling the OCL Standard LibraryEdward Willink
 
Model-Based Co-Evolution of Production Systems and their Libraries with Auto...
Model-Based Co-Evolution of Production Systems and their Libraries with Auto...Model-Based Co-Evolution of Production Systems and their Libraries with Auto...
Model-Based Co-Evolution of Production Systems and their Libraries with Auto...Luca Berardinelli
 
IncQuery gets Sirius: faster and better diagrams
IncQuery gets Sirius: faster and better diagramsIncQuery gets Sirius: faster and better diagrams
IncQuery gets Sirius: faster and better diagramsÁkos Horváth
 
Enriching Your Models with OCL
Enriching Your Models with OCLEnriching Your Models with OCL
Enriching Your Models with OCLEdward Willink
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Christian Schneider
 
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!Michał Ćmil
 
MERIMeeting du 27 mai 2014 - Parallel Programming
MERIMeeting du 27 mai 2014 - Parallel ProgrammingMERIMeeting du 27 mai 2014 - Parallel Programming
MERIMeeting du 27 mai 2014 - Parallel ProgrammingOlivier NAVARRE
 
Compatibility Prediction of Eclipse Third-Party Plug-ins in New Eclipse Releases
Compatibility Prediction of Eclipse Third-Party Plug-ins in New Eclipse ReleasesCompatibility Prediction of Eclipse Third-Party Plug-ins in New Eclipse Releases
Compatibility Prediction of Eclipse Third-Party Plug-ins in New Eclipse ReleasesAlexander Serebrenik
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]Alex Ershov
 
ScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin OderskyScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin OderskyTypesafe
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionPVS-Studio
 
Acceleo Best Practices - Obeo.pdf
Acceleo Best Practices - Obeo.pdfAcceleo Best Practices - Obeo.pdf
Acceleo Best Practices - Obeo.pdfClaudiaNaveda2
 

Similar to Safe navigation in OCL (20)

Enriching your models with OCL
Enriching your models with OCLEnriching your models with OCL
Enriching your models with OCL
 
OCL 2019 Keynote Retrospective and Prospective
OCL 2019 Keynote Retrospective and ProspectiveOCL 2019 Keynote Retrospective and Prospective
OCL 2019 Keynote Retrospective and Prospective
 
O caml2014 leroy-slides
O caml2014 leroy-slidesO caml2014 leroy-slides
O caml2014 leroy-slides
 
OCL - The Bigger Picture
OCL - The Bigger PictureOCL - The Bigger Picture
OCL - The Bigger Picture
 
The End of the world as we know it - AKA your last NullPointerException $1B b...
The End of the world as we know it - AKA your last NullPointerException $1B b...The End of the world as we know it - AKA your last NullPointerException $1B b...
The End of the world as we know it - AKA your last NullPointerException $1B b...
 
OCL in EMF
OCL in EMFOCL in EMF
OCL in EMF
 
PLP-L1-Intro.ppt
PLP-L1-Intro.pptPLP-L1-Intro.ppt
PLP-L1-Intro.ppt
 
2010 06 22 omg - obeo
2010 06 22   omg - obeo2010 06 22   omg - obeo
2010 06 22 omg - obeo
 
Modeling the OCL Standard Library
Modeling the OCL Standard LibraryModeling the OCL Standard Library
Modeling the OCL Standard Library
 
Model-Based Co-Evolution of Production Systems and their Libraries with Auto...
Model-Based Co-Evolution of Production Systems and their Libraries with Auto...Model-Based Co-Evolution of Production Systems and their Libraries with Auto...
Model-Based Co-Evolution of Production Systems and their Libraries with Auto...
 
IncQuery gets Sirius: faster and better diagrams
IncQuery gets Sirius: faster and better diagramsIncQuery gets Sirius: faster and better diagrams
IncQuery gets Sirius: faster and better diagrams
 
Enriching Your Models with OCL
Enriching Your Models with OCLEnriching Your Models with OCL
Enriching Your Models with OCL
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
 
MERIMeeting du 27 mai 2014 - Parallel Programming
MERIMeeting du 27 mai 2014 - Parallel ProgrammingMERIMeeting du 27 mai 2014 - Parallel Programming
MERIMeeting du 27 mai 2014 - Parallel Programming
 
Compatibility Prediction of Eclipse Third-Party Plug-ins in New Eclipse Releases
Compatibility Prediction of Eclipse Third-Party Plug-ins in New Eclipse ReleasesCompatibility Prediction of Eclipse Third-Party Plug-ins in New Eclipse Releases
Compatibility Prediction of Eclipse Third-Party Plug-ins in New Eclipse Releases
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
 
ScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin OderskyScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin Odersky
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
Acceleo Best Practices - Obeo.pdf
Acceleo Best Practices - Obeo.pdfAcceleo Best Practices - Obeo.pdf
Acceleo Best Practices - Obeo.pdf
 

More from Edward Willink

OCL Visualization A Reality Check
OCL Visualization A Reality CheckOCL Visualization A Reality Check
OCL Visualization A Reality CheckEdward Willink
 
A text model - Use your favourite M2M for M2T
A text model - Use your favourite M2M for M2TA text model - Use your favourite M2M for M2T
A text model - Use your favourite M2M for M2TEdward Willink
 
Commutative Short Circuit Operators
Commutative Short Circuit OperatorsCommutative Short Circuit Operators
Commutative Short Circuit OperatorsEdward Willink
 
The Micromapping Model of Computation
The Micromapping Model of ComputationThe Micromapping Model of Computation
The Micromapping Model of ComputationEdward Willink
 
Optimized declarative transformation First Eclipse QVTc results
Optimized declarative transformation First Eclipse QVTc resultsOptimized declarative transformation First Eclipse QVTc results
Optimized declarative transformation First Eclipse QVTc resultsEdward Willink
 
Yet Another Three QVT Languages
Yet Another Three QVT LanguagesYet Another Three QVT Languages
Yet Another Three QVT LanguagesEdward Willink
 
Model Transformation A Personal Perspective
Model Transformation A Personal PerspectiveModel Transformation A Personal Perspective
Model Transformation A Personal PerspectiveEdward Willink
 
Fast, Faster and Super-Fast Queries
Fast, Faster and Super-Fast QueriesFast, Faster and Super-Fast Queries
Fast, Faster and Super-Fast QueriesEdward Willink
 
Enrich Your Models With OCL
Enrich Your Models With OCLEnrich Your Models With OCL
Enrich Your Models With OCLEdward Willink
 

More from Edward Willink (12)

An OCL Map Type
An OCL Map TypeAn OCL Map Type
An OCL Map Type
 
OCL Visualization A Reality Check
OCL Visualization A Reality CheckOCL Visualization A Reality Check
OCL Visualization A Reality Check
 
A text model - Use your favourite M2M for M2T
A text model - Use your favourite M2M for M2TA text model - Use your favourite M2M for M2T
A text model - Use your favourite M2M for M2T
 
Shadow Objects
Shadow ObjectsShadow Objects
Shadow Objects
 
Commutative Short Circuit Operators
Commutative Short Circuit OperatorsCommutative Short Circuit Operators
Commutative Short Circuit Operators
 
The Micromapping Model of Computation
The Micromapping Model of ComputationThe Micromapping Model of Computation
The Micromapping Model of Computation
 
Optimized declarative transformation First Eclipse QVTc results
Optimized declarative transformation First Eclipse QVTc resultsOptimized declarative transformation First Eclipse QVTc results
Optimized declarative transformation First Eclipse QVTc results
 
Yet Another Three QVT Languages
Yet Another Three QVT LanguagesYet Another Three QVT Languages
Yet Another Three QVT Languages
 
UMLX and QVT and ATL
UMLX and QVT and ATLUMLX and QVT and ATL
UMLX and QVT and ATL
 
Model Transformation A Personal Perspective
Model Transformation A Personal PerspectiveModel Transformation A Personal Perspective
Model Transformation A Personal Perspective
 
Fast, Faster and Super-Fast Queries
Fast, Faster and Super-Fast QueriesFast, Faster and Super-Fast Queries
Fast, Faster and Super-Fast Queries
 
Enrich Your Models With OCL
Enrich Your Models With OCLEnrich Your Models With OCL
Enrich Your Models With OCL
 

Recently uploaded

A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfkalichargn70th171
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesNeo4j
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdfkalichargn70th171
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabbereGrabber
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfMeon Technology
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfVictor Lopez
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignNeo4j
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAlluxio, Inc.
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfmbmh111980
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Soroosh Khodami
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfOrtus Solutions, Corp
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...rajkumar669520
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockSkilrock Technologies
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems ApproachNeo4j
 

Recently uploaded (20)

A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by Design
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by Skilrock
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 

Safe navigation in OCL

  • 1. Made available under EPL 1.0 Safe Navigation in OCL Edward Willink Willink Transformations Ltd Eclipse Foundation MMT Component co-Lead OCL Project Lead QVTd Project Lead QVTo Committer OMG (Model Driven Solutions) OCL 2.3, 2.4, 2.5 RTF Chair QVT 1.2, 1.3 RTF Chair OCL 2015 @ MODELS 2015 28th September 2015
  • 2. 28-Sept-2015 Safe Navigation in OCL 2Made available under EPL 1.0 Overview The null navigation problem Inadequate solution "?." and "?->" safe counter parts to "." and "->" Viable solution non-null object declarations null-free collection declarations ...
  • 3. 28-Sept-2015 Safe Navigation in OCL 3Made available under EPL 1.0 null C.A.R.Hoare 2009 "I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler." a good goal for OCL "But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years." ignored in OCL for too long OCL is broken
  • 4. 28-Sept-2015 Safe Navigation in OCL 4Made available under EPL 1.0 null in OCL null has many, but not all, object characteristics use of a missing characteristic crashes aPerson.father.name.toUpper() obviously fails if aPerson is null fails if a father is null inevitable in a finite model fails if a name is null quite possible in an incomplete model DATA DEPENDENT RUN-TIME FAILURE and we think OCL is a better language
  • 5. 28-Sept-2015 Safe Navigation in OCL 5Made available under EPL 1.0 Cures Strong declarations C++ references: int& works Java annotations: @NonNull Integer fails on unannotated system/library/framework code Safe navigation operator Groovy, Python, Xbase my?.name pushes problem sideways Mitigation
  • 6. 28-Sept-2015 Safe Navigation in OCL 6Made available under EPL 1.0 OCL Safe Navigation Operators 1 Safe Object Navigation Operator x?.y shortform for if x <> null then x.y else null endif Safe Collection Navigation Operator x?->y shortform for x->excluding(null)->y
  • 7. 28-Sept-2015 Safe Navigation in OCL 7Made available under EPL 1.0 OCL Safe Navigation Operators 2 null hazards can be avoided aPerson.children.name->toUpper() aPerson?.children?.name?->toUpper() ugly 4 rather than 2 operators to confuse novices need tooling
  • 8. 28-Sept-2015 Safe Navigation in OCL 8Made available under EPL 1.0 Safe Navigation Operator WFRs Error: Safe Navigation Required. a.b If the source could be null, a safe navigation operator should be used to avoid a run-time hazard. Warning: Safe Navigation not Required. a?.b If the source cannot be null, a safe navigation operator is unnecessary and may incur overheads. How do we determine could be null for OCL?
  • 9. 28-Sept-2015 Safe Navigation in OCL 9Made available under EPL 1.0 Non-Null Objects Constants 4 Set{42} Constant Expressions if ... then Set{42} else Set{} endif But objects are rather useful if self = x then y else z endif
  • 10. 28-Sept-2015 Safe Navigation in OCL 10Made available under EPL 1.0 Non-Null Object Declarations New syntax - e.g. C++ references UML syntax optionalName : String[?] mandatoryName : String[1] [?] String value is optional; null value is permitted. [1] String value is required; null value is prohibited. [*], [+], [2..5] etc not appropriate for single Object OCL extension let/iterator variable types may have a multiplicity let name : String[1] = ... in ... someNames->forAll(name : String[?] | ...) OCL legacy default is [?], UML default is [1]
  • 11. 28-Sept-2015 Safe Navigation in OCL 11Made available under EPL 1.0 Non-Null collection elements Collections are a very important part of OCL OCL: Collections can contain null elements in practice very few do OCL: Any iterator variable may be null in practice iterator variables are non-null Major inconsistency between OCL and practice
  • 12. 28-Sept-2015 Safe Navigation in OCL 12Made available under EPL 1.0 Null-Free Collections New syntax / Extended UML syntax UML-alignment requires bounded collections Sequence(Integer)[1..2] one or two element sequence Sequence(Sequence(Real)[3])[3] 3x3 matrix OCL extension collection | element multiplicity Set(String)[+|1] collection multiplicity: + => one or more element multiplicity: 1 => non-null => null-free collection
  • 13. 28-Sept-2015 Safe Navigation in OCL 13Made available under EPL 1.0 Null-Free Collection Example
  • 14. 28-Sept-2015 Safe Navigation in OCL 14Made available under EPL 1.0 Null-Safe Libraries - Simple OCL Standard Library should be modeled planned for OCL 2.5/3.0, prototyped in Eclipse OCL semi-formal declarations String::toBoolean() : Boolean post: result = (self = 'true') pessimistically String::toBoolean() : Boolean[?] after analysis of post-conditon String::toBoolean() : Boolean[1]
  • 15. 28-Sept-2015 Safe Navigation in OCL 15Made available under EPL 1.0 Null-Safe Libraries - Complex 1 OCL 2.4: Set::including(object : T) : Set(T) vague is source T same as argument/result T? how are derived types resolved? Java analogy inappropriate Set(E)::add(E) : boolean Set is mutable, no creation, no type change OCL Set is immutable, new instance/type for result Clearer: Set(T)::including(object : T) : Set(T) All T's exist in library Choose the most derived T
  • 16. 28-Sept-2015 Safe Navigation in OCL 16Made available under EPL 1.0 Null-Safe Libraries - Complex 2 Set(T)[*|e1]::including(object : T[e2]) : Set(T)[*|e3] Informally: result is null-free if source is null-free and argument object is non-null Formally: null-free = true non-null = true e3 = e1 and e2 Pessimistic static modeled definitions
  • 17. 28-Sept-2015 Safe Navigation in OCL 17Made available under EPL 1.0 Null-Safe Libraries - Complex 3 Set(T)[c1|e1]::including(object : T[e2]) : Set(T)[c3|e3] Pessimitic, very simple multiplicity is always 0 to unlimited. c1.lower = 0, c1.upper=*, c3.lower = 0, c3.upper = * Pessimitic, more accurate c3.lower = c1.lower c3.upper = if c1.upper = * then * else c1.upper+1 endif Null-safety requires element multiplicity modeling collection multiplicity modeling is comparable
  • 18. 28-Sept-2015 Safe Navigation in OCL 18Made available under EPL 1.0 Null-Safe User Models RoyalAndLoyal.ocl shows numerous errors RoyalAndLoyal.ecore inaccurate Kleppe & Warmer UML diagrams specify [1] Ecore has [?] defaults Fixing RoyalAndLoyal.ecore fixes Object problems But all Collection/Iterator problems remain add null-free EAnnotations
  • 19. 28-Sept-2015 Safe Navigation in OCL 19Made available under EPL 1.0 OCL Collection Stereotypes UML has no null-free Collection support fixable with a MultiplicityElement stereotype one fix per stereotyped MultiplicityElement OCL legacy - null-full collections OCL practice - null-free collections fixable with a Class or Package stereotype changed defauly throughout Class / Package
  • 20. 28-Sept-2015 Safe Navigation in OCL 20Made available under EPL 1.0 OCLforUML Profile (MultiplicityElement) Collection::isNullFree (Class or Package) Collections::isNullFree (InstanceSpecification) Validation::validate (Package) Validations::validate (DataType) Integer::maximum / minimum ... BoundedInteger ... Overflow (DataType) Real::maximum / minimum / epsilon ... FixedPoint, FloatingPoint ... Bits ... Rounding
  • 21. 28-Sept-2015 Safe Navigation in OCL 21Made available under EPL 1.0 Deep Non-Null Analysis let anObject : NamedElement[?] = .... in anObject <> null implies anObject.name <> null Variable declarations give pessimistic safety anObject : NamedElement[?] implies anObject.name unsafe Deeper analysis needed total analysis impractical simple implies/and/or practical TBD: defined in OCL in OCL specification
  • 22. 28-Sept-2015 Safe Navigation in OCL 22Made available under EPL 1.0 Experience Report Available in Eclipse Mars release (June 2015) optional error/warning/ignore severity Two non-trivial Complete OCL documents change ignore severity to warning numerous diagnostics - depressing add safe navigation operators hard work - wrong correct user model declarations stronger design - success
  • 23. 28-Sept-2015 Safe Navigation in OCL 23Made available under EPL 1.0 Summary OCL is seriously unsafe null-wise Naive safe navigation operators confusing Intelligent Analysis tooling requires non-null object declarations: [?]/[1] multiplicity null-free collection declarations: [...|1] multiplicity null-safe library collection declarations Prototype available in Eclipse OCL (June 2015)