umlify: Generate uml from your ruby source files
Hi.
I made a gem that automatically generates a uml diagram from your source files. I would suggest reading the whole article, but if you’re in a hurry, here is the link.
Please, tell me what you think (comment down there or mikaa123 at gmail), and if you are interested by this project, we can work on it together.
Ah! Thanks for staying. ;)
Uml and dynamically typed languages such as Ruby don’t fit well together. There are a few reasons for that. As Rubyists, we love the agile principles, and since our code speaks for itself, why bother repeating ourselves, right? Moreover, spending time on our code rather than on a design artifact gives us time to document it properly, and to re-factor it. As a matter of fact, uml design isn’t an important discipline in most agile methodology, if it exists at all.
This is just the tip of the iceberg. Ruby is dynamically typed and includes constructs that doesn’t map with uml. Good luck if you want to design a DSL with uml. Something as simple as an uml association between two classes wouldn’t really make sense in Ruby.

Why is that? Because Ruby doesn’t impose a type when you declare an instance variable. You don’t do:
class Foo
def initialize
String @a_string
end
end
to say that @a_string is a String.
By drawing an association on your uml diagram, you restrict the possible set of classes that could have potentially fit.
There’s also another problem: unless you use an integrated tool like Together, nobody is ever going to keep the uml design up to date. Once you’ve start coding, the design gets deprecated the minute you change even the tiniest bit of your code.
With this said, I love uml. I do because it’s something that we all understand. We can talk about our code without having to actually show code. It adds abstraction and gives us this “step back” that allows us to think and move even further.
I also think it’s a great because it gives visual people (like me) a “map” of the project. It’s an amazing documentation and communication tool. With uml, you can talk to your clients even if they have no knowledge about software engineering.
That’s why I created umlify. It’s a ruby gem (you can install it by doing gem install umlify) that automatically generates a uml class diagram from your ruby source files.
umlify 'lib/**/*'
# Parses all the files from the lib folder and outputs it to uml.html
You can include it in your Rakefile as a task so you always have an up-to-date uml diagram.
Please go check the Github page.
If you are interested by this project, I’d love to hear from you (mikaa123 at gmail). Any comments or uml-related ruby stories you have would be welcome, too.
Have a good day! ;)
()
