ifacethoughts

Learning Ruby

When I started learning Ruby, I had to fight on multiple fronts to be able to comprehend some concepts. I think it would have been easier if I was not already too deep in languages like C++ or Java. Not to say that they are inferior to Ruby or anything, but Ruby does bring in new concepts and new ways of programming. There already are some excellent resource lists, like this one by David Heinemeir Hansson. However, coming from a background of C++, Java and PHP some of my readings started shaking my basic understandings of programming. This was because I jumped at using Ruby without understanding its essence. I discuss some resources and some points that I helped me build on my existing knowledge.

On the first day of learning ruby the first document I came across was the Programming Ruby: The Pragmatic Programmer’s Guide. It is more than just an introduction, it is quite comprehensive in its coverage. But it does not explain underlying philosophy of Ruby. One of the concepts that I had strugged with in the beginning was of duck typing. It plays a founding role in making Ruby a dynamic language.

Ruby borrows some concepts from functional programming, like treating functions as first class objects and closures, lambda functions or anonymous functions. Though the concept was easy to understand, I had to make more effort to understand how to effectively use them. A programmer cannot ignore these at any costs, they form one of the foundations of some programming techniques in Ruby.

The next document I came across was Ruby User’s Guide and I wish I had read this earlier. It provides practical applications right from the beginning which demonstrate how Ruby can make a difference. It answers some of the questions that a programmer with experience in other languages has. The use of eval.rb there through the guide is especially helpful. Ruby from other languages served as a good migration guide, but it is still limited to the syntax aspects and does not delve into the conceptual differences.

Once you are comfortable with the concepts, reading this comical but convincing book helps discover some tips and tricks. I had tried to read it earlier, but found it confusing. I could enjoy and use it more after I had cleared some of my doubts. If Ruby is going to be your first programming language, Learn To Program is a must.

Once you are through with these, go ahead and browse through the Core API and the Standard API.

At this point I was comfortable in writing simple applications in Ruby. I was however, nowhere near using it for some of the previous projects I had done. My experience with past programming languages had shown me that even if I read a lot, applying them to solve domain problems was a different animal. I started looking for use of Ruby in real world applications and was content to find that there is no dearth of them. I downloaded a couple of applications and libraries and studied them. This helped me in understanding using programming techniques to solve certain real world problems.

Now I started looking at peripheral techniques like installing ruby, various additional libraries and using packages like Ruby Gems. The Ruby community is very helpful and responsive for troubleshooting if you get any problems.

There are many more things you can do with Ruby, especially because of its flexibility. You can go through advanced topics like metaprogramming which can be used for writing DSLs.

It was impossible to not come across Ruby On Rails while learning Ruby. But I consciously did not delve into it as it is not only a framework but also can be used as a DSL for web programming. However, there were some interesting workarounds or tips and tricks for Ruby on its site, like using Unicode in Ruby.

After the initial joy and happiness of using Ruby I started looking for its disadvantages. I firmly believe that there is no single solution for all problems. If Ruby is applicable somewhere, it will not be somewhere else and to be able to determine this we need to know not only its pros but also its cons. Advantages and disadvantages of Ruby provide some background on this. The basic complaint has been about its performance in some scenarios and issues like lack of native support in Unicode.

Ruby is continuously improving by addressing these scenarios, so no resource list or guide can be sufficient. You will have to keep reading and experimenting as Ruby evolves. There are a lot of blogs and wikis being written, a lot is being discussed in the mail groups and forums on Ruby. Keep a tab on them and experience Ruby.

Discussion [Participate or Link]

  1. Rashmi said:

    How do I install ruby on windows? I downloaded the binary. What next? Did not find many resources on thi. Can you help.

  2. Abhijit Nadgouda said:

    You can use the one-click RubyInstaller for Windows which includes everything you need to work with Ruby.

    If you choose to install separately, just execute the binaries to install it. You can use Ruby directly from the command line using “ruby” command once it is installed, but will have to be configured with a web server like Apache to be able to use it for web programming.

  3. iface thoughts » Blog Archive » But There’s CakePHP said:

    [...] Matthew Magain suggests that PHP developers are most likely to adopt Rails. I don’t see any specific reason, apart from the fact that PHP developers are already used to the open source environment. Otherwise PHP has more off-the-shelf functionalities/packages available. To enjoy benefits of the Rails design there is already an excellent PHP alternative – CakePHP. I think they might be more open to learn the programming language Ruby though, which provides a fresh alternative with the philosophy of lesscode. [...]

  4. iface thoughts » Blog Archive » Get Clear With Functional Programming said:

    [...] I started my journey into learning Functional Programming (FP) with introduction to Ruby. And as days have passed, more and more modern languages include functional programming features. However, there were instances of confusion while exploring FP as coexisting with OOP. And each time I kept going back to this same article which explains its essence, its benefits and its ideas. Check it out, it will help a lot if you are currently in your baby steps towards FP. [...]

  5. PHP Is Good on iface thoughts said:

    [...] So, why am I learning Ruby? If I have to create a framework from scratch I will choose Ruby over PHP. Ruby is more intuitive for creating leaner and cleaner code because of some functional programming features and has facilities for easier metaprogramming. But from a project perspective, PHP will always be one of the primary candidates. [...]

  6. Sushil said:

    the content provided is really good I mean I really came to know where should I actually start from.
    The other links u provided are really good.
    I thank u for this from the bottom of my heart.
    I was really looking forward to it.
    Regards,
    Sushil

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.