News from project codegen

Mikhail Zabaluev did some great work on codegen. He basically rewrote all the XSL templates and modified the internal XML format generator in such a way that codegen allows for nice XSL templates.

Codegen is a LGPL code generation framework that will generate boilerplate code from simple class diagrams using or XSL templates or other generator implementations.

At this moment will codegen generate C#, VB.NET, Ruby, PHP5, Java and GObject classes and interfaces. The GObject support is not finished, but we are working on this.

For example: Codegen will, using XSL templates, build a complete working Visual Studio .NET solution from your UML class diagram. Codegen supports both XMI and the uncompressed DIA format.

Mikhail updated the GObject template a little bit. He added some extras that will make it possible to fully correctly generate both GTypeInterface interfaces and GObject classes. I’m also planning to support generating configure.ac and Makefile.am files.

Some (but not all) features:

  • Codegen supports fixing the UML types to the programming language specific types using so called “fixers” (A sample fixer for .NET). Such fixers can also fix other target specifics like inheritance and implementation details.
  • Codegen supports grouping your types into namespaces and assemblies, libraries, “make targets” or however you call it in your favorite programming environment. Codegen uses the UML package tool for this.
  • Codegen is rather a framework for code generation than a standalone application. Codegen is meant for integration with your own tools and/or environments. It has been designed for this. So codegen does not (yet) include fancy user interfaces or cool UML diagram editors. Mainly because that isn’t the scope of codegen. It can be used as plug in component for your own development environment.
  • I’m at this moment very open to huge design changes, ideas and/or decisions for codegen. This can also be viewed as a feature if you are actually planning to start using codegen in some cool way.

Codegens scope isn’t to generate implementation code. You, as a programmer, should do that. But you can very easily modify the XSL templates and put your business implementation rules in it. You can, for example, let it use a in-house developed library or framework. That framework isn’t going to be generated by codegen. You’ll have to build that, if you want to use it.

I recommend existing frameworks like Spring and Hibernate for stuff like this. There are also .NET versions of these frameworks.

I don’t do frequent releases for codegen. So you’ll need to get a checkout from the Subversion repository. If you are interested in helping me do releases or just want to help coding codegen, contact me.

3 thoughts on “News from project codegen”

  1. It’s worth noting that Ruby support is also not finished, and the command-line application doesn’t even include Ruby generation as an option. I haven’t made a commit in a little over a month, but I’m still working on finishing this.

Comments are closed.