[Uml-devel] Proposal for templates in code generation (fwd)

Jonathan Riddell jr at jriddell.org
Fri Feb 28 13:30:11 UTC 2003


Attachment was too big for the list, available at
http://uml.sf.net/developers/code-generation-model.xmi

---------- Forwarded message ----------
Date: Fri, 28 Feb 2003 16:12:53 -0500
From: Brian Thomas <thomas at mail630.gsfc.nasa.gov>
To: umbrello-devel at kde.org
Subject: Proposal for templates in code generation
Resent-Date: Fri, 28 Feb 2003 13:20:21 -0800
Resent-From: <umbrello-devel-admin at kde.org>
Resent-To: jr at jriddell.org


	Hi again.

	As promised" Im back to bug you all about code generation using user-defined
	templates.

	I've already outlined some of the motivation for doing this so I wont go into that
	here. Basically, here's how I would approach the problem:

	1. Change the way that current code generators work. Instead of receiving UMLConcept
	    and then writing it directly to a (language-specific) file, I would have each code
	    generator return a "ClassCodeDocument" which could model what the output might
	    be.

	2. In the code directory, there might be an existing "ClassCodeDocument" containing user-specified
	    differences that are read in, and merged with the auto-generated ClassCodeDocument in 1. Each
	    class would have its own ClassCodeDocument. All of these together would be joined to form the
            "ProjectCodeDocument". SO, a UML document which contains *more than one* type of project would
	    generate *more than one* ProjectCodeDocument.

	3. A GUI editor, which is language specific, would outline and preview what the code to be generated
	    would look like by reading in each ProjectCodeDocument available. The user can use this editor to
	    add/change/delete/hide comments, classes and methods in the output code. When they are satisfied
            with their edits, they can hit the "generateCode" button which calls ClassCodeDocument->generateCode()
	    If the user hits "Save Edits" then new "template" CodeDocuments are written appropriately. IF the user
 	    edits the UML diagram and goes back to the "Code View" then the auto-generated parts of the CodeDocuments
	    should be updated as well.

	Did anyone follow that? Im happy to do some more explaining. Im attaching an xmi file which details the
	CodeDocument structure/classes.

	Should people be amenable to this proposal, I am willing to do most of the coding, up to and including translating
	some of the existing code generators to work with the new framework. I may need help to create the GUI editor and
	understand how the dynamic loading of the codegenerator library works.


															Cheers,


															=b.t.








More information about the umbrello-devel mailing list