[Novalug] Ruby on Rails?

David Bock dbock at fgm.com
Mon Jan 15 14:51:04 EST 2007


Rails is actually several frameworks, written in ruby, that can 
dramatically speed up the creation of a website driven by a database.

Key features of importance are:

1) ActiveRecord - an incredibly slick implementation of an 
object-relational mapper, this is akin to Hibernate in the Java space 
(and it can be used in Ruby without having to swallow the entire rails 
package).

2) ActionPack (the ActionView and ActionController frameworks), together 
with ActiveRecord, form a complete Model-View-Controller stack.

3) Convention over configuration - all of these things work well 
together because they follow simple, predictable naming conventions. 
Dozens of lines of configuration (typically done in XML with Java) are 
replaced by simple conventions - if you have a model named "person", it 
will map to a database table called "people", will have a controller 
called "person_controller", and there will be a directory in the views 
part called "person".  Each method in the controller has a corresponding 
view file with the same name in the view folder.  Each column in the 
table maps to an attribute on the ruby class.

All of those are overridable, but if you drink the rails kool-aid, stuff 
just assembles together wuickly.

4) Declarative programming.  Instead of having to write a bunch of code 
for behavior, you can actually write things like:

has_many :addresses
has_one :spouse
belongs_to :user_group
validates_presence_of :email_address

and your model will suddenly have that behavior.  Again, you can extend 
the default behavior, but if the default does what you want it to, it 
just works.

5) Code generation.  to start a rails project you type:

rails myproject

and it will create everything you need to have the skeleton of the 
project (not unlike Maven in the Java world).  It will even make 
assumptions that you have a database called myproject_development and 
one called myproject_test.

Once you have the project, there are generators for models, controllers, 
views, etc.  They look like crap, but you know, sometimes half the 
battle of getting your web app up and running is getting all the 
plubling working - once you have it, you can hack away to make it look 
like what you want.

6) A well-planned mechanism for extending your app by installing 
'plugins', and a vibrant community writing tons of them.


The whole thing combines into a wonderfully fun and productive work 
environment.  And of course, there is a big active community of 
developers - and I don't have to tell a linux user group how nice it has 
to have a community for support.


I recently read in some science rag (New Scientist, Discover, etc). 
that a better predictor of burnout was not the number of hours people 
worked, but how productive people felt - that is, if you feel 
unproductive, you are more likely to feel burnt out than if you are very 
productive during the same amount of time.  As I read that, I realized 
that being hyper-productive actually makes me feel un-burntout... that 
is the best way I can describe actually working on a rails project from 
beginning to end.


-db



Alan McConnell wrote:
> On Mon, Jan 15, 2007 at 01:40:48PM -0500, Keith Casey wrote:
>> On 1/15/07, David Bock <dbock at fgm.com> wrote:
>>> Bruce Tate's book "From Java to Ruby: Things Every Manager Should Know"
>>> is excellent, but not from a technical point of view.  If you are a
>>> developer trying to introduce ruby/rails into your organization, there
>>> is a lot of material in there to help.
> 	Again:  Ruby we understand.  But what is the "rails" part?  (repeat
> 	of query)   "Curious minds . . . ".
> 
> Best wishes,
> 
> Alan
> 



More information about the Novalug mailing list