Genotrance

Icon

Random thoughts, ideas and experiences

Where’s Ruby and Rails?

There is a lot of attention being given to PHP, Perl and Python on this blog. Where’s Ruby? And where’s Ruby on Rails? Over the few past years, I’ve realized the importance of having the right tools for the job. That’s why I use Perl for scripting and PHP for the web. It’s not like I’ve not given Ruby and Rails a try. In todays market, you can’t afford to be stuck with the wrong tools. You have to keep up with the times in order to succeed. I’ve kept my eyes open ever since. Regardless, there has been too much activity on the web surrounding the whole Ruby on Rails phenomenon for me to not have noticed anyway.

Ruby on Rails (RoR) is said to be the best thing since sliced bread. The initial flurry of news articles and blogs caught my attention early on. I was so fascinated at one point that I hunt down every RoR article out there in the attempt to understand how it works. All that reading had me pretty impressed. I finally got myself to play with RoR a few months back and found it to be a pretty cool approach. Turns out it is so cool and revolutionary that it has spawned an entire generation of web APIs for a variety of languages. RoR has literally made MVC (Model, View and Controller) a household name for web programmers by making it fun, easy and practical, so much so, that now it seems to be the only right way to develop any web application in order to succeed.

The Wow Factor

It’s good that RoR is getting the attention it has gotten over the past two years of it’s existence. Ruby is a beautiful language and deserves the attention. It’s syntax makes it a very clean and readable language to program in. Being object oriented from ground up, everything is an object, thus making the language consistent and predictable. Lastly, it has all the qualities of PHP, Perl and Python that I described in an earlier post.

Ruby’s been around for a long time but has been more of an esoteric language. RoR is what has made Ruby famous. Many copy cats have appeared since RoR hit the scene but none are able to beat its clean and effective approach mainly because Ruby is so powerful. Some famous programmers of today even swear by RoR on their blogs and claim it will surpass Java in the web application space. RoR really kicks JSPs where it hurts. The configuration by convention approach makes setting up a new application fast and easy. If anything needs to change through development, it is automatically picked up instead of having to tweak ugly XML configuration files. And being an interpreted language, there’s no compilation phase slowing you down. Lastly, you are set free from the class path hell of Java. Of course, the main reason for RoR’s success is the fact that programming in Ruby is fun. It is not a boring drudgery and so the programmer is allowed to have a fun experience while building and testing the features of his application. Add to this the fact that Ruby is not a very verbose language and you can understand why developer productivity can sky-rocket in comparison with languages such as Java. There’s probably more niceties but these are what stand out for me.

RoR recently reached its 1.0 release thanks to a very active developer community surrounding the project. The blogosphere is filled with good experiences and rave reviews. Also, the splurge of recent web applications built using RoR is helping spread the word quickly. The result of all this enthusiasm is a growing number of job opportunities around Ruby and RoR. The phenomenon is still small, but it is growing very rapidly and it seems like the tipping point has been crossed already.

Some Hurdles

The fact that you have to learn a completely new language and attitude towards programming is a major hurdle for any aspiring RoR enthusiast. This is applicable to any new technology but needs to be said regardless. Ruby’s syntax and approach is a little different than most languages a typical programmer would know so it is that much harder to learn. Ruby was also virtually unheard of until RoR made it known to the world. The word is still fresh and there’s still resistance to accept this new entrant. Of course, Ruby is far from new but that’s how you end up treating something that is new to you. I don’t have many complaints about Ruby. There’s wonderful documentation, tutorials and articles out there. It’s been around for a long time and is mature. Ruby is also very consistent so in that sense, it is easier to learn. I think the biggest hurdle would be to think up a practical application to write in Ruby so as to learn the language.

As for RoR, where the hell do you start with it? It is hard to get into for newbies. It’s hard to know where to start. The API documentation is overwhelming; too many methods all in one page. You can’t find something in that documentation if you don’t know that it exists in the first place. And the tutorials on the web are just the first ten minutes worth of programming. What about some advanced features? I have to buy a book for that? This problem may get rectified over time as more and more developers adopt RoR and put up tutorials of their own. But until then, expect a struggle.

The main problem, in my opinion, is that people jump straight into RoR instead of getting familiar with Ruby. You can’t learn a new programming language when your attention is focused on an API that extends the language. The API seems ridiculously difficult simply because you don’t know the language in the first place. All the logic of a RoR program has to be written in Ruby. RoR only provides a framework and some extensions with which web applications can be easily written. Any aspiring RoR developer needs to be reasonably proficient in Ruby before even bothering with RoR. Ruby is a little radical for all those C and Java programmers and will prove to be a hurdle if they dive into RoR directly. This is not clearly pointed out anywhere and is one of the reasons that people crib so much about RoR before loving it.

The 10 minute videos obviously don’t talk much about Ruby. They show you how RoR works because they are RoR tutorials, not Ruby tutorials. But an enthusiastic aspirant who wants to dive into RoR quickly may be disappointed since that’s not the best way to get started. He needs to be directed to learn Ruby first. In our enthusiasm, we may forget this basic requirement but the Ruby on Rails documentation page should help by having bold links to decent Ruby tutorials and warn aspirants to come back only when they know their way around Ruby and not any sooner. If this is not done, valuable developer mind share is lost or delayed. Once you fall in love with the language (which is easy since Ruby is so nice), then RoR is easy to pick up.

I can imagine the following steps before someone says: “I love Ruby on Rails”:-

  1. Wow that sounds cool, let me try it out.
  2. Ugh, why is this so hard?
  3. This sucks, I hate it.
  4. Wait, I need to know Ruby.
  5. Let me try again.
  6. Wow, it’s the best thing ever.

How often have you seen such posts and articles? Anyway, I’m at #4. Many get to #3 and bail. Few make it to #6. Luckily, these #6 guys are loud and talkative so the rest of us have the motivation to keep trying.

Another pet peeve of mine is that getting RoR set up and running on Windows with Apache and FastCGI is a big pain. Without FastCGI, the Ruby interpreter is dog slow. This may have improved since the last time I got RoR up and running several months back. Regardless, I’d prefer an efficient mod_ruby instead of FastCGI. The reason I need a Windows install is because I end up doing all my development on my laptop and finally deploy my web applications on my Linux servers, no choices there. Considering I also have some PHP work going on, I’d love it if XAMPP would distribute a Ruby add-on as it would nicely integrate with the stuff I already have installed. Stuff like Instant Rails does not work for me since I already have Apache, MySQL, etc. Ya, I could use WEBrick, but that’s not nice either, since I’d rather develop and test my app on a real world web server that is already running on my system. I’ve not even bothered getting RoR running on Linux since I have nothing to deploy yet but am hoping it will be a little easier using a package manager.

One last point of frustration is the ridiculous number of directories for a typical RoR application. Why do we need so many directories, nested in this bizarre fashion? Ya, I know, configuration by convention, but man is it inconvenient for a newbie. So you either get to deal with XML files or a crazy directory structure with multiple files which have only 5-6 lines in each of them! That’s just weird and hard to get used to. This may never change but is something that has bothered me since the first time I played with RoR.

Conclusion

So I’m at #4. I’m yet to learn Ruby to the point where I’m comfortable using it. It seems easy but I am wondering about what program to write in order to learn the language. I’d rather write something that will be useful to me. But until I figure that out, I’m stuck. For now, Perl is still my scripting tool. Python is still my toy for GUI applications. And for the foreseeable future, my web apps will still be written in PHP, albeit with a RoR’ish framework, phpFw, which I put together over time. Let’s hope I pick up Ruby and RoR before it is too late.

Advertisements

Filed under: Programming

2 Responses

  1. jamongkad says:

    Hi I also used PERL as my scripting language…well up until I’ve met Ruby 🙂 Lets just say that I’m also at #4. I’m currently learning the ins and outs of Ruby as it is indeed a language you must master in order to know your way around Rails. I’m kind of vexed with the tutorials on the net though very helpful to familiarize yourself with RoR. But leaves me want something more. I’m glad to find a fellow RoR enthusiast who shares a insatiable hunger to learn all things Ruby/RoR. I’m currently trying to figure out on where to use Ruby as well…aside from writing small games and knick knacks with the language.

  2. I worked with RoR for about a year and had a ball with it. But with real estate it is location – with web apps it is IMPLEMENTATION. Implementation is sparse or very poor with most providers. They will basically tell you that you are on your own with RoR. It is a resource hog as well. It is not uncommon for someone to have their first RoR app working nicely UNTIL they go to deploy it.
    After playing around for a year with it, I suddenly realized I wasn’t doing a damn thing I couldn’t do with PHP or existing technologies. So why was I bothering? PHP now has CodeIgniter for the MVC programming discipline. The reality is this – RoR will do what can be done now only differently. So why is it touted as the greatest thing since sliced bread? I have no idea. I think programmers just get bored doing things the same way. They were thrilled to find something that was different. I agree there is a beauty to RoR programming that is different. However I think RoR’s niche will be large businesses – not medium to small businesses.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Twitter Updates

%d bloggers like this: