100% Pure Ruby(tm)
26 September 2006
Recently I've been doing a fair amount of work in Ruby. And yes, I've felt super-productive. Particularly compared to Java.
The downside of working in Java is the 100% Pure Java(tm) mentality. In the search for a clean and cohesive system, we take the attitude that if it's not pure Java, it's crap. In Java, if we need something to happen periodically, we might examine TimerTask, decide it's insufficient and move on to Quartz. So we add it to our build, figure out the API, realize it conflicts with some other dependency. Well, damn.
With Ruby, it's scripty enough to not feel the need to have a 100% Pure Ruby(tm) mentality. A Ruby system needs something to occur periodically, we just open a pipe to crontab and hand that bit off to cron.
"But Windows doesn't have cron!"
Use a better operating system.
The majority of systems deploy to Linux or some other Unix-alike. Developing on a Unix-ish system only makes sense. You wouldn't prepare to drive an RV by tooling around in a Kia Sportage, now would you?
When you break free of the JVM mentality and assume a sensible host operating system, you realize that the OS itself is your virtual machine to play in. If it's in your $PATH and can be expected to behave reasonably well on any sane Unix-like OS, by all means, use it.
Back to the premise... Since Ruby is indeed "scripty" you can accomplish a crapload just using a pair of backticks, effectively not even using Ruby at all.
And you can do it without guilt or complication. Completely unlike punting to Runtime.exec(...). That always makes you feel dirty.
Perhaps Groovy and JRuby will help break the never-escape-the-JVM attitude. Give a developer backticks and easy pipes to subprocesses, and no telling what sort of nefarious things he might could do.