OCL Resources
|
OCL was developed by Jos Warmer as a business modeling language within IBM and derived from Steve Cook’s and John Daniels’s Syntropy method (Cook and Daniels, 1944). In 1996 the OA&D Domain task force at OMG issued a request for proposals on Object Analysis and Design. In January 1997, IBM and ObjectTime Limited received the proposal, one important aspect of which was the introduction of OCL. During 1997 IBM and ObjectTime collaborated with the UML project. OCL was IBM’s first contribution to UML 1.1. The recent success of UML (OMG, 1999; OMG, 2001) has also led to increased popularity of OCL (Warmer and Kleppe, 1999b), especially from the 1.1 version of UML up onwards, when this language is used in the UML standard. The OMG is currently working on the new version OCL2.0, where an important new aspect is a well defined meta model, which makes it easier to develop OCL tools. OCL is currently used in the definition of other OMG standards. In the specification of MOF (OMG, 2000a), for example, OCL is used to define the more complex concepts of the MOF model. It is likewise used in the specification of XMI (OMG, 2000b) to specify the manner in which a model is transformed into a document. OCL is also used in software development processes to improve the expressiveness of certain artefacts in the analysis and design phases. Another use is to provide support to certain UML extensibility mechanisms. In UML models, constraints written in OCL can be used to supply complementary information, at a conceptual level, to achieve higher precision and accuracy within the model. In particular, OCL can be used to (OMG, 2001):
The main characteristics of OCL OCL is a semiformal language that can be used to express constraints on a variety of software artifacts. UML users and those of other modeling languages can use OCL to specify constraints and other expressions in their models, as well as to describe business rules explicitly (Gottesdiener, 1999). The main characteristics of OCL are:
Examples of the types of expressions
that we can write with OCL are invariants, preconditions, postconditions,
guards, navigation expressions, etc. Each OCL expression is attached
to a model and describes specific characteristics of the model. An example in OCL The following diagram of UML classes serves as an example for kinds of constraints. In UML, we use OCL to write the constraints. Each constraint is defined in the context of a specific instance of the class indicated. The most common kinds of constraints are: invariants, preconditions and postconditions. An invariant constraint attached to a class means that all instances of the class must satisfy the constraint. Both preconditions and postconditions are constraints attached to operations or methods (Warmer and Kleppe, 1999a). On the other hand, the reserved word self is used to refer to the instance in the actual context. The OCL constraints attached to the diagram in Figure 1 are given below:
For more information about OCL, see references (OMG, 1999; OMG, 2001; Rational, 2000) and the following websites: OCL Home http://www.klasse.nl/ocl; IBM,http://www3.ibm.com/software/ad/library/standards/ocl.html; Rational, http://www.rational.com; OMG , http://www.omg.org./uml . |