(someone unplug my machine and make me go to bed...)
Still reading over Tim Bray's articles on some Ruby coding, and he has one bit about how cool and easy it was for him to dive into the net/http.rb file and debug some stuff.
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'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?
I've been recently picking away at a small website project that I started as my excuse to learn Rails. This blog is homegrown in oldschool Ruby CGI as my excuse to learn Ruby - I should get my brain more modern. But, I just didn't have the patience and time to be that stupid again, and I've fallen back to just persisting my simple object array with YAML and avoiding any concerns about installation and configuration of everything. Just a handful of scripts and it's up and running.
While I do very much love ActiveRecord migrations, having done a homegrown DSL of sorts in that direction before on a prior gig, since my brief flirtation with Rails I've been nursing an ill-informed theory that there's too much magic in the bowels of Rails. My only two hints of direct facts are (1) a third party plug-in that when I tried to debug into was doing so much meta programming stuff that I didn't even try (2) some anecdotal evidence from the DallasRb group trying to read their way through the routing code in Rails and it being not the easiest stuff in the world to read. Okay, three (3) hearing/reading various small bits of all the code generation magic that Rails does on the fly. (Okay four (4) aren't old timers always complaining about how many codebases in C (or was it C++) sucked because the creators were being overly clever and overloading operators and sneaking in crazy macros and stuff like that?)
That's a very lame body of evidence there ... but I just wonder if that sort of complexity will eventually come to be a complaint of Rails: that it's great when it works, but when you need to work through glitchiness, you will be the un-Tim Bray, wondering how any Rubyist would dare refer to Perl as a write-only language out of fear of damnation from the Black Kettle Society.
Nevertheless, there are many, many tools I live with on a daily basis I'm sure I could not begin to spelunk into -- compilers and whatnot, and perhaps if Rails code stays as un-readable as I'm unashamedly presuming it to be it will still continue to kick arse and simply be one of the tools that few have fu enough to venture into.
If either of you reading this can knock some sense into me, please do ... after you've plugged my machine back in in the morning.
Update: GlennVanderburg didn't read this on his own volition, but after a virtual arm-twist, he, being a man who's making his living from Rails these days, commented that while the routing code was a mess, it's been rewritten and on the whole he's not had problems scouring through the Rails source. It looks like all the time I put into proactive excuses above was not wasted. It also looks like I've now refactored this entire entry away. Please disperse.
Update: via AdamKeys -> Jamis Buck walks you through the routes DSL in rails.
tags: ComputersAndTechnology