Pergunta

I had a discussion with a professor today on OCL. He believes invariants, post-conditions, and pre-conditions are allowed within the defined contexts of functions.

The software developer in me leads me to want to believe OCL would allow general constraints to be placed on the model. Constraints like All objects of class Person in this model have a sex of male, or all objects of class car have four wheels seem incredible useful and using a declarative paradigm against my model feels right.

I kind of view it like the physical world. If we screw a nut on a bolt the nut is allowed to fit on in one way. These are physical constraints that hold no matter what action we take like screwing the nut on the bolt, and cannot be violated or we have invalidated our model in a fundamental way.

His view is that in OCL we can only define constraints (pre and post conditions/invariants) within functions that are provided a context.

Can someone clear this up for me?

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top