The Object Constraint Language: Getting Your Models Ready for MDA (2nd Edition)

In any model, comments are necessary to facilitate human understanding. This holds for a UML/OCL model too. It is good practice to accompany every OCL expression with a comment. A line comment is indicated by two minus signs: --. After this marker, everything on the same line is considered to be comment. Comments that span more than one line can be enclosed between /* and */.

For example, the previous invariant could have been accompanied by the following comments:

/* the following invariant states that the maximum number of points that may be earned by all services of a program partner is equal to 10,000 */ context ProgramPartner inv totalPointsEarning: deliveredServices.transactions -- all transactions ->select( oclIsTypeOf( Earning ) ) -- select earning ones .points->sum() -- sum all points < 10,000 -- sum smaller than 10,000

Категории