Browse Prior Art Database

Round Tripping Generated Text Based Files Disclosure Number: IPCOM000014024D
Original Publication Date: 2000-Jul-01
Included in the Prior Art Database: 2003-Jun-19

Publishing Venue



Today software code generators have little if any capability to deal with source code they generate being modified outside (externally) of the generator environment and then taken back into the generator for further possible refinement. In a common scenario, a developer does definition work of the developer’s object-oriented application inside the generator’s development environment. The definitions may have originated in another product such as the Rational Rose software development product, but the main point is that the generator’s description of the developer’s application classes and their implementation is the central source for the source code. Now there is still sometimes a desire and need to edit that implementation outside of the generator. For example during a simple compile, run, debug cycle it is normal to want to make a quick change in a method body, recompile and continue. When complete the source could be brought back into the generator. In current generators, there is limited capability for the round tripping of source code between a generator (or development environment incorporating a generator) and any other development environment as described above. In some code generators, a developer can import "changes". This means the developer can select a file, usually provided via an action item in the generator’s user interface and/or command line invocation, and it will be parsed for method body updates. This is done by recognizing method names and comment blocks to determine what should be updated in the generator’s internal model. However, the support is focused on developers wishing to edit “developer defined” method body implementations. This function can not be used to redefine signatures or types, and it can not be used to add or remove methods or attributes. One solution to provide more comprehensive round tripping of code is providing a complete source compiler in the generator for every code format the generator emits in order to parse the source and understand what changes have taken place. Other solutions include annotating the source in-line with structured comments or to have a side file that describes the source file. The disadvantage of comment annotation is that the source can quickly become unreadable as the amount of change support increases and the structured comments typically require unique parsing. The advantage is that it can be language independent, and does not create the problem of having extra files to manage. The side file approach keeps a minimal amount of annotation in the source file but has the disadvantage of being a second file to be managed. This disclosure describes a technique to extend current generators to provide for improved round tripping of code. This technique allows for external editing that can also be automated by other generation and editing tools. In short, the technique comprises "tagging" of the source code as if using a side file, but putting the side file information in a comment block at the bottom of the source file. In addition the meta data contained in the comment block will be in an XML compliant form. Consequently, the metadata needed to determine changes in the source code is provided in the source file via inline XML tagging in comment format. Moreover, XML parsing is a standard function that is now readily available and this technique avoids the unique parsing difficulties of structured comments.