[RAD stands for
Ruby Ape Diaries, of which
this is part IX.]
Ruby’s debugging facilities, compared to what IDE users like me are used to,
are, well... sincere.
At one point during the Ape work, I had a bug that was really driving me
crazy. The symptom was that my HTTP interaction with the server would just
freeze up, and I couldn’t spot the pattern behind it.
It’s a fact of protocol-testing life that this particular kind of shit happens.
Sometimes you’re reduced to debugging with print statements, and I was.
But after a while they weren’t helping me, I was calling
Net::HTTP#start
on an apparently-valid connection and
then... nothing.
Eventually, I was driven to looking in the library source,
net/http.rb
. Hey, it was easy to understand! (Have I talked about
Ruby and readability before?) I could see where
my request was going, but I couldn’t see how it could go wrong. Well, this is
a dev machine, and Real Men debug with print
statements. So in
they went... right into the Ruby distro libraries, I mean. And I ran it again. Only
took a couple of minutes to zero in the problem; in this case, a
JRuby bug.
I’m not sure what the lesson is... but the code spelunking was frighteningly
easy. This is not typical of other peoples’ HTTP libraries; I have bitter
memories of bashing my head to a bloody pulp against LWP back in the last millennium.
Did I mention readability?
[Ed. Note: You’ll be happy to hear that there are only a couple more RAD
entries in the pipeline, then I’ll be done.]