# Uml

**URL:** <https://www.ruby-forum.com/t/uml/102261>\
**Category:** Rails\
**Created:** [August 14, 2006, 4:45am UTC](https://www.ruby-forum.com/t/uml/102261 "2006-08-14T04:45:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jamie](https://www.ruby-forum.com/u/jamie)\
**Post date:** [August 14, 2006, 4:45am UTC](https://www.ruby-forum.com/t/uml/102261/1 "2006-08-14T04:45:51Z")

</div>

In Rolling with Ruby on Rails tutorial -  
[http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html](http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html) - I saw that to  
introduce a new element to my domain, I needed to define it in a table,  
generate a model element with a similar name and the class would  
autoamtically take the attributes from the table definition. Is it  
possible to do this in the other direction… i.e to take the class  
diagram and automatically generate the table definition. Would this be  
something build into Rails, or require a 3rd party tool?

My intention is to use RSA to define my domain model, export the classes  
to Ruby and use this to drive the scaffolding set up in Rails.

If you have any direct experince with this or can point me to other  
tutorials, it would be much appreciated!

---------\> Jamie

---

<div class="post-metadata">

**Author:** ![jamie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jamie](https://www.ruby-forum.com/u/jamie)\
**Post date:** [August 14, 2006, 9:50am UTC](https://www.ruby-forum.com/t/uml/102261/2 "2006-08-14T09:50:54Z")

</div>

Rails, specifically ActiveRecord [the ‘Model’ in MVC], serves the very  
specific role of object-relational mapping and as a result the entire  
framework [currently] is very database centric [as intended by its  
author]… I came from an RSA [of course it was called rose back then]  
world and a similar experience that it seems youre having when being  
introduced to rails. What you need to look into is ‘Migrations’:

[http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations](http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations)

This essentially allows you to describe your database tables/handle the  
management and migration of them in pure ruby [as opposed to SQL] - you  
still have to describe their relationships in the Model classes that you  
generate as a result of the table generation.

Unfortunatly RSA [and arguably UML] won’t do you much good other than  
perhaps a UML-esque diagram of your model [which could be invaluable if  
things get complex] - the most popular UML concepts exist in database  
design as well, c.f. aggregation and has\_many, etc. As you’ll find  
modeling data is fundamentally similar regardless of what abstract lingo  
you choose to author it in…

Theres also a difference of culture at play [I’m assuming] RSA, and all  
the tools in the Rational Unified Process are very concerned with  
process, documentation, etc. Rails is a framework geared toward Agile  
development, which is generally not concerned with formal processes, nor  
detailed documentation like a sequence diagram, et al. i.e. youre  
mixing apples and oranges…

Jamie wrote:

> In Rolling with Ruby on Rails tutorial -  
> [Radar – O’Reilly](http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html) - I saw that to  
> introduce a new element to my domain, I needed to define it in a table,  
> generate a model element with a similar name and the class would  
> autoamtically take the attributes from the table definition. Is it  
> possible to do this in the other direction… i.e to take the class  
> diagram and automatically generate the table definition. Would this be  
> something build into Rails, or require a 3rd party tool?
> 
> My intention is to use RSA to define my domain model, export the classes  
> to Ruby and use this to drive the scaffolding set up in Rails.
> 
> If you have any direct experince with this or can point me to other  
> tutorials, it would be much appreciated!
> 
> ---------\> Jamie

---

<div class="post-metadata">

**Author:** ![jamie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jamie](https://www.ruby-forum.com/u/jamie)\
**Post date:** [August 14, 2006, 4:11pm UTC](https://www.ruby-forum.com/t/uml/102261/3 "2006-08-14T16:11:35Z")

</div>

Hey Brez,

Thank you very much for your response. I do plan on using the Agile  
methodology, rather than RUP, but am using UML as a notation at my  
disposal to define the domain model. Irrespective of methodology this  
is an essential artifact and I believe describing the domain model is  
easier using a class diagram than an ERD. Though both will work.

Perhaps I should look towards object-relational mapping tools, so that I  
can convert from XMI to SQL and then bring it into Ruby through the  
database route?

---

<div class="post-metadata">

**Author:** ![jamie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jamie](https://www.ruby-forum.com/u/jamie)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/uml/102261/4 "2006-08-15T14:19:44Z")

</div>

I have heard that Nitro/OG is setup in this fashion. Haven’t tried it  
first  
hand though, so not sure how valuable it may be.

-NSHB

On 8/14/06, Brez! !! [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This essentially allows you to describe your database tables/handle the
> 
> > In Rolling with Ruby on Rails tutorial -
> 
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Kind regards,

Nathaniel B.

Inimit Innovations Inc.  
[http://inimit.com](http://inimit.com)

---

<div class="post-metadata">

**Author:** ![jamie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jamie](https://www.ruby-forum.com/u/jamie)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/uml/102261/5 "2006-08-15T14:19:48Z")

</div>

My recollection of the entirety of the Rose/RSA toolset is fuzzy,  
but I do remember it being tricky to model dynamic stuff.

Migrations in Rails are inherently dynamic, you build in extra  
migrations to expand your DB schema as your entities/models  
grow and evolve. I dont know if RSA models this very well.

---

<div class="post-metadata">

**Author:** ![jamie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jamie](https://www.ruby-forum.com/u/jamie)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/uml/102261/6 "2006-08-15T14:19:59Z")

</div>

On Aug 14, 2006, at 1:50 AM, Nathaniel B. wrote:

> I have heard that Nitro/OG is setup in this fashion. Haven’t tried  
> it first hand though, so not sure how valuable it may be.
> 
> -NSHB

```
Nitro/Og is setup this way. With Og as the ORM you just define

```

normal ruby classes. Then you use attr\_accessor and friends which Og  
overides to add persistence to the db transparently. Its really quite  
slick. I would encourage anyone using rails to also check out Nitro.  
Its a bit different but its very nice in its own way.

-Ezra
