Automatic Code Generation
Despite what many CASE tools advertise, we are still far away from being able to completely generate the full implementation of a software application from its analysis (and design) models. In general, tools are just able to generate the skeletons of Java classes (or relational tables) that represent the class diagram modelled by the designer but are unable to cope with the generation of the dynamic part of the system and/or to generate the checking code needed to prevent that integrity constraints are violated during the application execution and/or to handle derived information.
This paper presents a list of open problems still to be solved before a full code generation becomes possible. You may want also to check the poor support for textual languages (as OCL or similar), which are needed to completely define constraints, derived elements and operations as part of the application specification. With graphical constructs (as the ones provided by the UML) we can only represent a subset of them (as cardinality constraints).
My research in this areas has addressed:
- The development of an automatic method for the efficient verification of OCL constraints . Since the method works at the modelling level, CASE tools can easily integrate this method in order to be able to cope with the efficient code generation of OCL constraints. This was the topic of my PhD Thesis.
- An initial (and automatic) generation of the dynamic aspects of the specified software application. Given an initial class diagram, our method automatically generates the OCL contracts of a set of operations that describe how users can modify and evolve the data managed by the application. This set is complete (all data can be modified through the operations) and executable.
- A heuristic-based transformation to translate declarative operation specifications (i.e. operations specified by means of a set of OCL pre and postconditions) into equivalent imperative specifications (i.e. operations where the set of actions or structural events that will be issued when executing the operation are explicitly defined). The main problem we must face when performing this transformation is the ambiguity of declarative specifications. The same declarative specification can be translated into many different imperative ones. The heuristics help us to determine which alternative is the one that, most probably, the designer prefers.