Strong opinions, weakly held

Just hack

I’m pretty sure that I exhibit one of the failings common to experienced developers trying to learn a new thing. That failing is an unwillingness to just hack out code.

I’ve been working with Ruby on Rails for a few months, but not as much as I’d like, mainly because I have many duties beyond just typing code into a text editor. That’s unfortunate, because I enjoy coding. I have lots of experience with many other languages, so Ruby on Rails was easy to pick up. If you know Java and Perl, you can pick up enough Ruby to get things done in hours.

Unfortunately, as an experienced developer I feel like it’s not enough to write Ruby. I need to write idiomatic Ruby. I need to write Ruby code that looks like it was written by someone who really knows Ruby, and who has worked with other Ruby developers. I want my code to be clean and readable and maintainable. I don’t want people who look at my code to say, “That dude is obviously a Java developer who dabbles in Ruby.”

The thing is, there’s no way to get to that point without just hacking. You can read all the books you can find. You can search the Rails wiki for examples. You can search mailing list archives. But when you’re starting out, if you want to get things done you have to do the best you can and put the aesthetics on the back burner. The beauty of refactoring is that you can just make your code work at first and worry about making it elegant later.

I keep forgetting this lesson, and just had to re-teach it to myself again last night.


  1. Danny O'Brien

    May 5, 2006 at 1:09 am

    I’m in much the same position, but one thing I find useful these days is that if I’m doing test-first work, then I can hack out something dreadful first pass, and then fiddle around with it a little to see what works and what doesn’t. So I’ll gradually drop in more ruby idioms like “yield” blocks and duck-typing, but only after my own first version works.

    It saves you diving down that rathole where you’re trying to do the right thing, but it doesn’t work, so you try something else, and that doesn’t either, and finally you end up with about fifteen half-understood idioms all smershed up, and nothing working.

  2. Came across this presentation on Ruby idioms this morning: http://www.cbcg.net/talks/rubyidioms/

Leave a Reply

Your email address will not be published.


© 2019 rc3.org

Theme by Anders NorenUp ↑