2

I'm thinking about defensive programming here, through model driven design. I would insert null guards where a property must not be null, but would use a Maybe struct in the cases where it's admissible.

However, I'm not sure how to explicitly model in OCL when a property can or can not be null.

João Otero
  • 185
  • 1
  • 6
  • 2
    Give this a read. Provides both an answer and an alternative to null. [Null Considered Harmful (for Transformation Verication)](https://pdfs.semanticscholar.org/88bc/0013c1c8f5e94c9a9f529f98019473120448.pdf) – candied_orange Apr 04 '19 at 14:53
  • I've read the article but it's still not clear to me how would I declare an OCL constraint for an expression that "can" be null. I don't have a background in formal verification, but it seems irrelevant to me... I'm not trying to verify anything, neither map transformations... just to model when an expression could be or should not be null – João Otero Apr 07 '19 at 14:27

0 Answers0