Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rails uptake time?

 
Gustavo Quiroz
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. My question is:

How much time (hours) do you think a competent java programmer (e.g. a certified one) needs to invest in order to be productive using Rails and what topic(s) do you think are the most difficult for him to address?

Thank you.
[Edit to provide meaningful topic - Dave]
[ January 30, 2007: Message edited by: David O'Meara ]
 
nhm tanveer hossain khan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"...How much time (hours) do you think a competent java programmer..."
- 1 night (2 to 4 hours) to learn Ruby, i don't know about "a certified one", but for me it took this time.
- 1 night (2 to 4 hours) to learn Rails.
- 1 night for a small project.
----------------------
sum = 3 nights to become a Ruby on rails developer

"....are the most difficult for him to address..."
i think the syntax itself. you can't predict which type of method or property name is going to be used. more over it has virtual property support. you can't get any clue what are the properties of a domain model object. unless you go through the database table.

for example:
-------------------
class Category < ActiveRecord::Base
end

you can't predict, what are the "property" inside "Category" object.

more usually in java:
-------------------
class Category {
private String name;
// setter getter
}
you can get the hints.

NOTE: this is not a limitation, it is an excellent feature. it helps a lot to adopt any changes from your real database table.

best wishes for your Rails journey ...
 
Justin Gehtland
author
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the *syntax* of Ruby is quite easy to pick up, though the *idioms* will take longer. Things like the extensive enumeration support, multiple ways to pass blocks, and the ability to bind procs to local state all take some time to make a normal part of your code.

When you tack Rails on top of it, the other mind-shift you'll have to make is to the conventions Rails uses for naming, routing and persisting. It can be difficult to tease out, sometimes, what is a feature of Ruby, and what is a feature of Rails. A good example of this is the Rails inflection mechanism (which turns "MyObject" into "my_objects" but "Person" into "people").

The switch shouldn't be too bad, though. I think the previous poster might be an outlier to the "fast" side of the curve, but the standard will be closer to that than to, say, 6 months.
 
Terry Jeske
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Justin,

I tried to pick up RoR before, and kind of got disenchanted with the Ruby language (loved active record however). I think this disenchantment started when the author of the book began to use a lot of ruby short cuts, which made the code a bit more cryptic. I have also noticed that many ruby developers tend to like to show how concise they can be, in lieu of easy to follow code. What path does your book take? i.e. Do you err on the side of legibility when providing examples?
 
Justin Gehtland
author
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We've tried very hard to do two things with the code samples in the book:

1) making the code structured in such a way as to be familiar to a Java programmer, while at the same time...
2) making the code conform to standard Ruby idioms

For example, here's a sample from our XML chapter showing how to use REXML to pull elements from a target document.



A Ruby fanatic might "simplify" the code into:



Both of those are idiomatic Ruby, but the former is much more legible and represents the style of the code in our book.

(*note: the second code sample I just re-wrote off the top of my head, so if I typed it incorrectly, well, sorry. ;-) )
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...or you could go in the middle and make the latter a bit more readable:

or even
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic