Posted by Kev.in
on November 30, 2007

Ruby developers like to be clear in their naming of variables, modules, classes, methods, and so on. I believe this comes from the idea that code should need very few inline comments if it is written clearly and descriptively. This descriptive naming strategy, combined with the decidedly non-English origins of Ruby (Japanese) and Rails (Danish), often result in oddly-named creations such as #execute_query_as_logged_in_user_without_transaction_logging (which I just made up), and #validates_numericality_of (which is real).
A newcomer might find these tongue-twisting, hyper-descriptive naming conventions maddening, but most of the time the intent becomes so much clearer as a result, it becomes infectious; in no time you find yourself writing your own 30-letter, borderline-semantically-correct method names and producing highly maintainable, readable, self-documenting code. That doesn’t mean it happens all the time, though…
Continue reading…
Posted by Kev.in
on November 29, 2007
Over at Rails Authority I use a great client-side syntax highlighter called SyntaxHighlighter to make code examples look nice, but it doesn’t support Valid XHTML , so I enhanced it to handle an XHTML-compatible style, e.g.:
<pre>
<code class="code xml:nogutter">
Your IP address is <%= @client_ip %>
</code>
</pre>
(Inspired by Ernest’s post, linked above.)
Continue reading…
Posted by Kev.in
on November 26, 2007
While getting fat on turkey and mashed potatoes in Minnesota over the holiday, I discovered a great little radio show called Radio Lab, which is also published as a podcast. I had originally heard a clip of their show on This American Life a couple months ago, but despite Ira Glass’s ringing endorsement, I hadn’t sought out a listen until the night before flying. Boy, am I glad I did.
What’s Radio Lab? Think Car Talk (but more production and no phone calls) meets Bill Nye the Science Guy. What I like about the show is that the topics are science-focused, and the hosts (Jad and Robert) banter and discuss things in a lively way. It’s not boring; rather, it’s engaging and the pace moves swiftly. The production seems almost built for the attention-deficit world we live in: some key phrases are repeated for emphasis, there is some narration on top of recorded stories to provide clarification, and there is discussion in a conversational tone. It all adds up to a really fun and enlightening experience.
I managed to listen to eleven podcasts on four flights and while drifting off to sleep each night over the last few days. If you’re looking for a place to start, my favorite episodes so far have been Morality, Musical Language, Memory and Forgetting, and Who Am I?. It’s a fairly deep-thinking, hour-long show, so I’m not sure how it would hold up under the demands of driving (I often find my mind wanders as I drive regardless of what I listen to). But if you can manage to concentrate fully and follow along, you’ll be rewarded with some truly mind-enhancing moments.
And, if nothing else, you’ll be able to spout off random, newly-learned fun-facts at parties. Did you know that some animals sleep half of their brain at a time?