Play with Ruby

I need to “play” with a programming language before I find myself really comfortable with it. Playing doesn’t just mean solving some problems or writing an app, but instead simply experimenting with the available functionality — exploring instead of producing.

TextMate has served me well for this, as I can write some code and immediately run it with Command-R, or even selectively run lines of specific code. This is all useful, but knowing the code available to even write requires already knowing the language, or some extensive back-and-forth with reference documents.

Unfortunately, I don’t memorize things quickly (especially programming reference material), so I’ve often leaned on code-completion with other languages to browse available methods and properties. It’s a crutch in many ways, but is perfect for exploring the abilities of code in it’s context, and after a few similar tasks the reference is no longer needed. Unfortunately, there’s no auto-complete in TextMate.

Fortunately, another way to play with Ruby is with IRB, the interactive Ruby shell. I find it helpful to often keep a terminal window open with IRB to construct something and experiment with it before implementing it in a function. IRB by default has no code-completion, but the support is there. Eric Lake demonstrates adding tab completion to Ruby’s IRB.

Leave a Reply

Your email address will not be published.