The MetaSieve Blog

January 8, 2010

Using Grails for creating UML diagrams

Filed under: Uncategorized — Tags: , — Björn Wilmsmann @ 7:59 pm

Back in the old days (like, 5 years ago …) when embarking upon a new software project you would (hopefully, that is …) usually start by sketching the underlying model using ER or UML diagrams.

No matter if you’re on the more enterprisey side of software development that requires more complex upfront documentation or if you’re going down the agile road, there had to be at least some sort of a model.

Problem is, once you’ve drawn that model in your favourite UML design tool or just with good ol’ pen & paper, you have to turn that model into code. Although the more expensive UML design tools allow for code creation and sometimes even feature round-trip abilities (that is code changes are reflected in the diagram), most of them are far from perfect in that they mostly produce fairly generic Java code that has to be heavily customised depending on the framework you’re using.

Even worse, if you use another language like Groovy or Ruby you likely have to start writing code from scratch.

However, fortunately for Grails there are two nifty plugins that offer an elegant way out (see http://railroad.rubyforge.org/ for a Rails solution):

Both automatically create UML diagrams for your app’s domain model. The main difference between those two is that the former draws upon yUML.me, a very promising web service that allows you to create UML diagrams with a Wiki-like syntax.

So, nowadays I don’t even bother firing up Visual Paradigm – the UML design tool I liked best before – anymore when I have to design a domain model. All I do is run ‘grails create-app’ and start writing actual domain class code! Thanks to GORM, Grails‘ object-relational mapping, writing actual code is easier and faster than drawing diagrams in a design tool.

Once I’m done I can use one of the plugins mentioned above to create a shiny UML diagram for impressing the customer and documenting the current state of the application.

Update: Sven Lange wrote a nice and more detailed blog post about Grails and UML diagrams, too: http://www.svenlange.co.za/?p=80

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: