Balancing On Rails

December 30, 2007

I am still alive!

My last posting was in August'07 and it's almost end of 2007. You must be thinking where did I vanish. One major thing happened is I got busy at my work. Working for a start-up has it's downfall. And it matters more when you are one of the pillar of the start-up. I can't just discard/delay the work so as to learn Ruby. That would make the customers go away. As much as I want to learn Ruby and Rails, the same amount of motivation I have for the start-up I work for. Hence, for past couple of months, I have been pretty busy and now that things are kind of under control (I hope so), I am back to learning Ruby.

At this point I also want to raise a point that many others might have been going through. I am a Java guy. I have been working on Java for more than 8 years. Before that I had worked on ASP and some amount of Perl. Though I have work consistently on JavaScript, my main development platform has been Java. Being in java world for so long, it's natural that the immediate transformation to a scripting language environment is not that so easy. Though Ruby is a OO language, but still there are some mental blocks that need to be overcome. The reason why people could easily move from C/C++ to Java was that Java maintained the similar way of writing programs. We all know Ruby is a high level programming language. However, with every programming language, it's expected to learn the new syntax etc.. While writing code in Perl or ASP or similar scripting language, you know that there is no concept of objects etc. So you just write your code and the execution happens top to bottom. But while imagining Ruby, somehow I was not able to do so. I was always trying to put Ruby with comparison to Java and it was getting very difficult for me to get out of the mental blocks. A simple example would be that in Java just a simple class that outputs  Hello World would be as below:

   1: class HelloWorld {
   2:     public static void main(String[] argv) {
   3:         System.out.pritnln("Hello World!");
   4:     }
   5: }

Now you know that every time you want to write a stand alone class, you have to have a main  method. But in Ruby, you would write as below:

   1: puts "Hello World!"

And that should work. It works because it's a scripting language. If you don't define a class, then it automatically becomes a part of Kernel object and gets executed.

Similar mental blocks are not easy to go away. So for sometime, I had no clue what I would do to get over the mental blocks. Finally, I found the book Rails for Java Developers  from Pragmatic Bookshelf. This book is a must read for every Java developer who wants to jump into Ruby and Rails. It would take your mental blocks away and get you ready to start writing code in Ruby faster. That's what I am doing now. Reading the book from start to end so that I am ready to balance myself on Rails.

On a side note, Ruby 1.9 is released though it's a development version release. Also released is Rails 2.0.1. Rails 2.0.1 does not support Ruby 1.9 as it got released before Ruby 1.9. This might mean that Ruby 2.0 is not far off and as far as the information in blogging world goes, there won't be much difference from Ruby 1.9 to Ruby 2.0 where as the difference between Ruby 1.8 to Ruby 1.9 is huge. I have not tried it to confirm that. So I assume Rails next version would include Ruby 2.0 if the release is not that far apart from Ruby 1.9.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home