UML with Rails

Hey has anyone used a good uml tool with rails to design applications? how do most start their rails application design work after collecting requirements? any guidance would be appreciated.

pk16 wrote:

Hey has anyone used a good uml tool with rails to design applications? how do most start their rails application design work after collecting requirements? any guidance would be appreciated.

The best Rails projects use Test Driven Development. That means you write a unit test that fails before writing any line of code. This provides tests that saturate your code, allowing many more flexibilities than traditional programming.

If a test fails unexpectedly, you can revert your code back to the state where everything passed. This ability replaces many long terrible hours debugging with short minutes writing lots of simple tests.

As a program grows, you can refactor its design to simplify it, and migrate its database elements, always trying to get the most features out of the fewest lines of code. Rails is very "lean" and "agile".

That said, http://railroad.rubyforge.org/ reads your models and draws a nice little table out of them.

Don't be fooled. Rails people do value planning, however, it doesn't seem like UML is very popular in the Rails world. Personally, I haven't found it useful, although your situation may be very different.

I really have little idea of available tools, much less which ones are good. What OS are you on? (maybe people who use your platform may be able to answer your question.)

If you are really interested in the development process promoted by most Rails developers take a look at Getting Real from the Rails creators.

Fair warning: It's probably going to be quite different that what you may be used to. This will fit for some, but not for others. Personally, this fits my style. It's made me a better programmer.

Thanks! I have been reading up on test driven development which appears to be a natural fit with rails as it bakes the tests in. I guess I just wanted to uml out some complex system ideas before coding, obviously it depends on preference and complexity.

I'll have a look at that 37 signals book though, thanks for the responses!!

There seems to be a good bit of confusion as to what UML is and isn't. TDD is a method for defining and verifying software behavior, Scrum and other agile methodologies are used for managing software development teams, Getting Real is more a philosophy or a manifesto than anything else. UML is none of these. It's a method (one of many) for describing and communicating design decisions for a software system, and in spite of the unnatural levels of suspicion it seems to engender amongst developers who've only ever worked on web apps, there are a lot of good reasons for wanting to do so -- i.e. communicating architecture to developers responsible for implementing a system, providing artifacts for support teams, etc. Whether you choose to use it or any other modeling method though, it won't force or prevent the use of any of the methodologies mentioned so far.

Regarding the use of a tool, the last time I used a specific UML modeling application extensively, it was MagicDraw from No Magic. They provide a simple tool that's all XML-based under the hood and very flexible. It allows you to define your own UML stereotypes including icons and so on, so as a first step, I'd define these for the basic Rails domain entities -- models, controllers and views -- and go from there.

Chris Kottom wrote:

There seems to be a good bit of confusion as to what UML is and isn't. TDD is a method for defining and verifying software behavior,

...and design...

Scrum and other agile methodologies are used for managing software development teams, Getting Real is more a philosophy or a manifesto than anything else. UML is none of these. It's a method (one of many) for describing and communicating design decisions for a software system, and in spite of the unnatural levels of suspicion it seems to engender amongst developers who've only ever worked on web apps

...and among developers who have worked on big-iron apps and seen UML abused...

For your second question, you can consider BDD. This is also test-first approach

Heh, for me it's not the webbiness of rails that kind of puts it at odds w/UML as a design tool, it's the agileness that rails devs (and probably rails itself) seem to favor. I have UML categorized in that "big design up front" class of tools. No doubt that's not quite accurate...