Mapping UML/OCL Models Into JML Specifications

The Unified Modeling Language (UML) (Rational Software Corporation, 2001) is a notation and a semantic language that can be used to model a system while the Object Constraint Language (OCL) (Rational Software Corporation, 2001; Warmer and Kleppe, 1999) is a part of standard UML that is used to define constraints and limitations of the system. When modeling a system, UML can described the system by using diagrams but can't e:xactly describe the constraints and limitations of the system specifically through the diagrams only. This is why we need OCL to add some important business rules and unambiguous explanations of the system. By using OCL, UML diagrams will have a better description noted along with it and give additional information about the system that is being modeled. In other word, the use of this precise and unambiguous OCL is to complete the UML diagrams. Another modeling language that has quite the same purpose as UML and OCL is the Java Modeling Language (JML) (Leavens and Cheon, 2004). The Java Modeling Language is a modeling language specifically for Java and it is used to add modeling annotations to Java programming language to define and describe the code with more explanations and understanding. This notation is quite similar to Java syntax but only appear within Java comments. It provides formal specification for describing invariants, preconditions and postconditions. The language describes mostly about what is actually the code do and this is one way to improve the Java programs with JML annotations. The UML, OCL and JML are used for modeling detailed design of software system. The UML and OCL model business specifications by using diagrams and constraints while the JML models the business specifications by adding annotations to Java coding. These languages have their own advantages and disadvantages. The main purpose of the project is to map the UML diagrams and OCL constraints into JML specifications. The project requires a case study to be mapped with UML diagrams and writing some constraints for the diagrams. The constraint will -be written by using OCL and it will be translated into JML annotations. The complete constraints for the diagrams will be used to generate some JML annotations. It will involve some translations from UML classes, attributes, associations and operations and also OCL invariants, preconditions and post conditions into JML annotations. This involvement in generating UML diagrams for the case study and writing constraints for the diagram by using OCL will give the experience in exploring the important of writing good and correct constraints for the diagrams. It is also involved in exploring the link between UML, OCL and JML and to capture their advantages and disadvantages of using one after another. The outcome of the project will be the evaluation of the languages and the process of mapping the diagrams and constraints into JML notations. The project involves some iteration process of drawing UML diagrams and writing OCL constraints. This process is to find a complete set of classes for the Class Diagram that represents the system specifications. The Class Diagram is the most important diagram for this project as it is the base diagram for writing OCL constraints. The Class Diagram also provide the project with the classes, attributes, operations and associations between classes that is used to map them into Java classes and JML annotations. For the time being, the achievement of the project gives the result of mapping UML diagrams, writing OCL constraints and mapping UML and OCL into JML annotations. The UML diagrams include the Use Case Diagram, the Activity Diagram, the Class Diagram, the Sequence Diagram and a documentation of data dictionary for the Class Diagram. The OCL constraints include some constraints for the invariants of classes and the preconditions and postconditions of methods. Both UMLand OCL are mapped into Java classes and JML annotations that include the JML invariants, preconditions and postconditions. The evaluation of the process gives the results of finding the advantages and disadvantages of each language including the benefits of using each of them to describe the system specifications. The project also discovers some tools that support JML specifications that allow the programmers to check their coding to see whether it satisfies the system specifications by testing and debugging JML annotations.