Difference between revisions of "OCL"
From Suhrid.net Wiki
Jump to navigationJump to searchLine 5: | Line 5: | ||
* UML only has a notion of an informal constraint in terms of a note - which can be attached to a model. However its just text. | * UML only has a notion of an informal constraint in terms of a note - which can be attached to a model. However its just text. | ||
* To write formal and machine checkable constraints - we use the Object Constraint Language (OCL). | * To write formal and machine checkable constraints - we use the Object Constraint Language (OCL). | ||
+ | |||
+ | = Assertions = | ||
+ | |||
+ | * In a program, assertions express constraints on program state that must be true at a '''specified point''' during execution. | ||
+ | * In a model/diagram, they document what must be true of an '''implementation''' of a modelling element. | ||
[[Category:OODE]] | [[Category:OODE]] |
Revision as of 06:03, 30 October 2011
Introduction
- How can we express constraints in UML ?
- E.g. the balance attribute in a SavingsAccount class can never be less than zero and more than 100000.
- UML only has a notion of an informal constraint in terms of a note - which can be attached to a model. However its just text.
- To write formal and machine checkable constraints - we use the Object Constraint Language (OCL).
Assertions
- In a program, assertions express constraints on program state that must be true at a specified point during execution.
- In a model/diagram, they document what must be true of an implementation of a modelling element.