08
Jan
09

How to become a better Ruby programmer

1. Buy the Pickaxe and put it on the John

Idea: Know the standard library

When I got an actual copy of Programming Ruby on paper, I found myself looking into it whenever I had spare time and no computer available – usually this was mostly on the toilet. ;)

That way I discovered so many useful methods and classes in Ruby’s standard library, you won’t believe it. Often times developers tend to reinvent some functionality, just because they don’t realize it’s already provided for them. And trust me, Ruby comes with quite some distinct features out of the box.

So my tip is to get a good book that covers the Standard Library or print it out somehow, and have it with you whenever you have to kill time, e.g. in a bus or the bathroom (or even for 10 minutes in bed).

2. Necromancer-Style: Create skeletons

Idea: When using a new tool or trying to implement a bigger feature, get started with just the boilerplate code

Often times, when I want to try out a new library, I hesitate, because of the steps necessary to get started with it. First I have to install it, and maybe some dependencies, then create a file with some boilerplate code, and sometimes also do some configuration.

Not until then can I really start with the actual functionality I want to try. And the worst thing is, weeks later I’d like to use the same library again in another project, can’t remember the procedure and have to do it all over again. And sometimes this keeps me from using that new library (e.g. RSpec) at all, because I can just resort to a good old tool I know (e.g. Test/Unit).

Another exemplification is starting a big feature, where you don’t know how to implement the actual business logic. My suggestion is, just start with something, even if it’s an empty file. And then create a test case, to tell yourself where you want to go. Remember, that you can also write empty (deferred) tests, which just exist to remind you of the behavior you want to realize.

Now when you take a break from the project, and have a Geistesblitz, you can directly open the file and start typing. Believe me, this shouldn’t be underestimated!

Rails is an ideal role model with all it’s generators. It is an important step to get a complete application skeleton
with the rails command, so can directly start with your business logic. And when you create a controller, it also creates a test case for you, to motivate you writing functional tests at all. Sometimes just creating that file and filling it with the necessary boilerplate seems to be too much for us (at least for me).

I recommend preparing the installation and initial configuration of new tools and features, and sometimes even automate this step. There are various ways to do this:

  1. You can add a snippet to TextMate (e.g. try Command+N in your test-folder, choose a filename, hit ENTER,  type tc and press TAB).
  2. Maybe it’s even enough to have a file somewhere in a directory, where you can just copy and paste the configuration.
  3. Ruby is also the perfect language for writing a small shell script to download a library or create necessary files.
  4. You could also write a complex generator for more elaborated tasks.

To sum it up: have a place where you can directly start typing your ideas without being distracted. Create file skeletons, and for more complex tasks, try to automate this step.

3. Don’t be shy

Idea: Communicate with other people on IRC to reinforce your comprehension

Chatting with fellow programmers has a number of advantages:

  1. You can ask questions to Ruby experts, which you haven’t been able to solve with the API documentation or a google search. Sometimes a question can spark really interesting discussions, you weren’t able to predict.
  2. When you help other people with a specific problem, oftentimes you increase your understanding in that area or see things from a different perspective. Many times when someone asks something I’m not sure of,  I open up IRB and just try it out. This lead to some new revelations, but also consolidated things I was already quite certain about. And don’t forget that your helping other people learning the language, which will keep the mutually assistence up.
  3. Hanging in the different channels will possibly bring new connections: maybe you find a project you’re interested in, because some people are constantly talking about it, or you just keep talking to the same guys over again. Which brings us the the next point:
  4. IRC is also a good place to meet new friends, after all everyone in #ruby-lang shares the same hobby, which is a good foundation, right?

So I suggest to just give it a try and download an IRC Client (on OS X i recommend Colloquy), connect to irc.freenode.net, and join #ruby plus #ruby-lang (there is also #rubyonrails or #shoes and many more specialized channels). But beware: it can get pretty addictive and distracting if you don’t watch it. ;)

About these ads

3 Responses to “How to become a better Ruby programmer”


  1. June 23, 2013 at 12:27 pm

    Or if you have your hairs poking out, most people will
    bikini wax be turned off. Getting a Bikini Wax looks great, it
    can make you feel great, and if it is too much to bear for
    the faint hearted.

  2. June 25, 2013 at 5:53 am

    There are several companies that currently deal in lancaster gate hotel
    london not to mention the production of fire retardant products.
    Dampers are also integrated into the design. This could be
    a neighbors house, anearby tree, whatever.

  3. July 10, 2013 at 6:23 pm

    So, wait no more to have your files transferred & exported to
    computer, just do it now in no time with this efficient utility and get over the hump and return to the team.
    The fear cripples them and they are important to add or
    subtract them from your comparison. Incremental online backup services: It
    is one of the different types of power sources used? Power Source
    The Online Backup Services system constantly monitors incoming utility power.

    The only way to ensure data at rest in a unified pipeline without
    slowing performance.


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


January 2009
M T W T F S S
« Aug    
 1234
567891011
12131415161718
19202122232425
262728293031  

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: