Home / Programming Ruby

Programming Ruby

Please Share...Print this pageTweet about this on TwitterShare on Facebook0Share on Google+0Pin on Pinterest0Share on Tumblr0Share on StumbleUpon0Share on Reddit0Email this to someone

Programming Ruby: The Pragmatic Programmers’ Guide, Second Edition
by Dave Thomas, Chad Fowler, Andy Hunt
Pragmatic Bookshelf

Ruby is one language I’ve always been curious about. Reading the tutorials has always been a breeze, the language is almost readable for your average human being, and I’ve always been impressed by the developer community– active and enthusiastic- that surrounds it.

I want to be part of that, is what I think to myself.

So, when the 2nd edition of the justifiably-famous Pickaxe book came up for review, I jumped at it. Weighing in at 800-odd pages, the author, Dave Thomas, has added around 50% or more to his previous edition. Mr. Thomas, if you don’t know of him, has been an author for programming books for some time, the earliest example of which I’d found being a style guide for Smalltalk.

Excited to get going, I downloaded the latest Windows installer for Ruby. This latest release contains, in addition to the core binaries themselves, the excellent SciTE editor, Freeride [an IDE] and several libraries.
The installer completed its work, and I fired Freeride up.

Nothing. Or next to it.

What I got was a console, stating the path was wrong or didn’t exist. Now, this was an odd thing, because I’d had an earlier release of Ruby [possibly 1.6] installed with the same OS, albeit on another hard drive, which worked. Scratching my head, I wondered what might possibly have changed and whether I’d the foresight to have kept it on disk somewhere. I hadn’t.

Nothing for it then, I figured. After submitting a couple of bug reports, I considered what to do. I know, I thought, I’ll simply install it on my Debian partition and that will be that.

Oh, my Lord.

The entire point of having a Linux installed upon your desktop is to have a system that can be customized to your liking. To promote choice and have the power to do things. More than some Linux advocates, the Debian folks believe that in spades.

So I need to ask: Why, oh why, did you break the unitary Ruby package into 34 separate libraries? Why do you bury it to the point where a humble user- such as myself- can’t, well, use it? You’ve got Python up, front and center, but Ruby? Why ever would someone want to use that?

Choice, indeed.

Any given Operating System reflects the requirements of the majority of its designers, especially in Linux, and perhaps not a little of bias creeps in, too. Like Microsoft choosing for you what you’re to play with, Debian eschews and seemingly buries Ruby in favor of other platforms. I realize that for those who are Debian diehards, this arrangement adds to that choice aspect. Not for me. To me, it was simply in my way, probably the most damning thing you could ever say about a Linux.
Its not like it hasn’t come up, guys.

Well, disappointed but undaunted, I returned to Windows. I’ll consider what to replace Debian with at a later time.

In the Windows distribution, there is a small console program called irb, Interactive Ruby. A majority of the exercises within Programming Ruby can be effectively run through this little program. The exercises do a good job of explaining the fundamental building blocks of Ruby, with a book-wide example of a jukebox program to tie it together.

The jukebox is not a full program, mind you, but an extended example. Often, I like to compose a full, short program [a word game, perhaps, where you guess letters in so many tries] to get the hang of things. Such little applications are fairly easy to do in Ruby.

Programming Ruby is a four-part book. The first covers generalities, mostly, and is an excellent introduction to the language. The second, Ruby In Its Setting, covers working with Ruby in various tasks and environments, such as the Windows API. The third part gets into more nitty-gritty details of programming, and the last is an exhaustive reference of all 98 libraries.
They are arranged, obviously, in an ascending order of complexity such that, depending on your familiarity with programming, you can scan here or concentrate there, focus in on whats important to you or read it all, front to back.

It is, without a doubt, valuable as THE standard work for Ruby, a virtual bible, and Mr. Thomas deserves resounding applause. With it in hand, its quite possible to move on towards making the application you’ve always wanted, but could never quite figure out how to do.

But its here that I have to fall back on my memory of working with Ruby prior to my unfortunate install. Ruby had/has very good libraries for GUI writing, including the Fox and TK packages. There’s a newer manger for them, too, called Gems, which imports code to be used for whatever you please. And I shouldn’t neglect Rails, though I have never seen it since Gems wouldn’t work, which is a Rapid Applications Framework I’ve heard does wonders for producing good code swiftly.

All in all, going through this manual was a frustrating experience for me when it really shouldn’t have been. I’m aware that many, many others have working, reliable Ruby setups, but it just didn’t seem to gel over here, despite nigh-heroic attempts to do so. 6 different installs, including ActiveRuby and mingwin32, wouldn’t cut it. The Mondrian IDE wouldn’t start. The charming, friendly tutorials went sadly to waste. Nevertheless, I’m anxious to give it all another try- I’m hardheaded that way- as I can easily see that Ruby has a lot going for it.

Powered by

About Urthshu

  • A correction and a question:

    Dave Thomas, of the Pragmatic Programmers, is not the Dave Thomas that contributed to the Smalltalk book you reference here.

    Wrt Gems, what happened when you tried to use it? It should be extremely easy with the latest Windows installer, since RubyGems comes with it. Please don’t hesitate to contact me directly for help on RubyGems.

    Chad Fowler

  • Thank you kindly for the correction, Mr. Fowler.

    WRT Gems, and the installation in general, it appears the paths were broken and so wouldn’t work at all.

    Since I went to the trouble to download Mondrian at their site, I took an opportunity to experiment with it. Apparently the .lnk files were fussy about double vs. single quotes on my Win98se platform, and this was repeated throughout the install.

    I suspect, though cannot confirm, that this niggling detail is part of the issue. Other than this, I confess to being at a loss.

  • The book is available online at Rubycentral

  • I was able to easily get Ruby working from the link in your article – I am using the pretty nice FreeRIDE – the only manual step I had to do was add my root Ruby directory (d:\ruby) to the Path variable from the Control Panel – only D:\ruby\bin was added by the install.

    Easy and interesting language – still exploring the shores – my favorite for a while has been C# – mainly because of the clean construction and flexibility.