Learning Ruby by Extension

So I’ve spent the past couple of months learning Ruby. My previous employers are python nuts. And I have to admit as languages go Python is pretty good. But then I heard about Rails and so I gave that a try.

Already a fan of MVC, Rails appealed to me for the same reasons it appeals to everyone else. It’s quick to develop! Still hunting for that killer Rails app I decided to take a look at what else Ruby could do and bought a copy of the pickaxe.

Now it just so happened that I learnt Python by writing a wrapper to the TibCo Rendezvous library. I learnt a lot about Python that way. Especially nasty, dirty stuff, like garbage collection, the GIL and other threading nasties. This is because the Rendezvous library does/requires a number of things internally:

creates/destroys memory that could have been referenced by a Python object

requires messages to be ‘pumped’ from its message queue and delivered possibly in the same or different threads

requires a callback from the RendezVous library back into Python code

These things generate a few programming challenges and require you to understand some internals of the language before you can make much progress. So it was by some curious happen-chance that I ended up involved with the Ruby version of the project.

So now I get to do it all again, but in Ruby! I’m hoping to make a better job of it this time, and I’m also helped by having some of the hard work already done. I’ll be posting various bits and bobs about the progress of this project as time passes.

In the main though, learning Ruby by extension has been overall quite pleasant. I disliked Python’s extension mechanism because it’s a bit of a pain to use and in the end I used Boost::Python instead of using the C fn() calls. In contrast then the Ruby extension mechanism is as clean as it can be and once a few simple rules are observed things mostly just work how you’d expect.

Now then, every concept in computing these days seems to have a TLA to accompany it which is also its mission statement, e.g: REST, DRY, blah, blah. Well I’ve now got my own. Here’s mine: SANS., Simple And No Surprises.

That’s what I want, simple programs that work how you’d expect, SANS-crap.