REVIEW - The Object Constraint Language - Precise Modeling with UML


Title:

The Object Constraint Language

Precise Modeling with UML

Author:

Jos B. Warmer, Anneke G. Kleppe

ISBN:

Publisher:

Addison-Wesley (1999)

Pages:

112pp

Reviewer:

Richard Blundell

Reviewed:

August 1999

Rating:

★★☆☆☆


The Object Constraint Language (OCL) is a simple but formal declarative language for specifying constraints, or 'universal truths,' about a system or a model of one. It is powerful enough to specify conditions of almost any level of complexity in an unambiguous manner, yet has been designed to be easy to learn and comprehend. It is more precise than 'natural language' descriptions, yet is much more intelligible than some other formal mathematical languages.

I know of only two ways that you can learn about OCL. First you can download the latest version (currently V1.3 alpha R5) of the UML documentation from the OMG web site (http://www.omg.org/) and look up section six, which is the OCL specification (and which is surprisingly readable for a standard document). Second you can read this book. Jos Warmer is the original IBM author of OCL and is currently responsible for the development of that part of the UML standard.

With a few exceptions, this book is quite similar in content to the standard document and they are both refreshingly concise (the standard is currently just 48 US-letter pages). Chapter one discusses why constraints are useful in modelling, including a discussion of design by contract using invariants, pre- and post-conditions. Chapter two covers OCL basics - the writing of simple constraints on attributes, classes and methods. Chapter three is a complete summary of OCL, basic operations and precedence, built in types such as Real and String, model types from the UML model and the collection types set, bag and sequence. Chapter four is a useful discussion of the use of constraints in modelling - a topic that is not covered in the standard. The short fifth chapter advises on ways to extend OCL consistently. Appendix A is a handy list of all the operations supported by the built in types and collections and Appendix B is a subset of the formal grammar. Both of these appendices are reproduced verbatim from the 1.1 version of the standard.

Although only published in October 1998, the book is out of date or incomplete in a few places with respect to the latest version of the standard, sometimes quite significantly. For example, the order of operator precedence has changed. The grammar in the appendix has since been extended to include explicit specification of context objects and operations with formal parameter lists, as well as the 'inv,' 'pre' and 'post' stereotypes, although these are explained in the text. There are also a number of technical errors in the examples. Having said that, the OCL standard itself is still evolving and I uncovered a number of errors in the current version of the standard document itself (which should be corrected in V1.4 due April 1999).

If you want to learn OCL, this is an accessible place to start and the section on modelling guidance was quite useful. However, be wary of the examples whilst learning and I would urge you also to download the most up-to-date version of the standard and consult that as a reference once you are up to speed with the concepts of OCL.


Book cover image courtesy of Open Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.