Archive for the ‘Ruby’ tag

One of the greatest difficulties of learning a new programming language or framework is that you don’t know if you’re doing things the right way. Tutorials and books can only take you so far, then you’re alone; it’s not as easy as it was in school where other people were willing to guide you through the more difficult concepts.

You think “I know there are areas where I could improve, where I could do things in a smarter way, but how?”  Ruby on Rails guides you towards doing the right things with its simplicity and convention over configuration mantra, but what about Ruby, just plain Ruby?

Ruby isn’t perfect, it’s not the easiest language to learn after almost a decade of C/C++ and its cousins Java and C#.  My first Ruby book quickly became obsolete; its code examples illustrate approaches that are out of date, deprecated or just plain wrong.  Suffice to say the pace of Ruby’s development isn’t going to slow down anytime soon.  So what do you do?

Frustrated, I thought to myself “Wouldn’t it be great to see how other people write and use Ruby code? To learn from their technique” Then it hit me like a brick, Unit Testing!  Almost every gem comes with its own unit testing folder.

I must have browsed through every Ruby Gem I have and read the unit tests, not only did I learn new Ruby techniques, I learned more about Unit Testing.  Now, the first thing I do after I download and install a gem is browse over to “C:rubylibrubygems1.8gemsgemnametest” and read the unit tests, there’s no better way to learn Ruby.

I still miss intellisense.

Old habits die-hard, I’m still tempted to put semi colons and curly braces in my Ruby code.  This is what happens when you are coding in two different languages.

Ever since I started programming in Ruby, I’m forgetting to declare the access modifier in front of my methods and other times I didn’t bother declaring a main method, I just started writing code in the middle of the class wondering why Eclipse is drawing red lines under my code.

I experienced the same problems when I was coding in C++ and Perl at work, and it took about a year to get over it.  At least then I was using a different IDE, lately I’ve used Eclipse for both Ruby and Java development and there’s nothing to remind me that I’ve started coding in a different language.

Maybe this is a sign that I should look into JRuby.

I’m writing Ruby code with a C++ accent, while Ruby’s core is small, it’s programming style is much more fluid and harder to get used, especially after coding in C++/Java/C# for the last 6 years.

Search