Ruby, so easy a wife can do it

posted @ Saturday, September 15, 2007 9:58 PM

 

I just have to share this.  So my wife asks me why I'm learning this new thing called Ruby.  She's usually not interested in the specifics of the programming languages I use.  (A few years ago, she asked me, "what's that C-Pound book you're reading?"  :)

So I broke out a pen and paper and wrote these 2 lines:

  • DateTime.Now.AddHours(1)
  • 1.hour.from_now

I asked her which one did she think was easier to understand.  She said "obviously, the 2nd one".  Bingo!

Then I wrote her another couple of lines:

  • for (int i=0; i<=3; i++) { // do something }
  • 3.times.do //something

Same question and she pointed at the first one in disgust and again said the 2nd was much easier to write.  Then she asked me why I'm not doing everything using the 2nd one.  Sadly, I couldn't really come with a good answer to that one except to say that it's just now gaining traction (even though it's been around for long time), it's open source, it doesn't come from Microsoft, blah blah.

Needless to say, the fact that my wife is telling me I need to start using Ruby more is definitely a sign.  Just not sure of what it's a sign of...

Comments
Joe - 9/15/2007 11:08 PM
# re: Ruby, so easy a wife can do it
Just wondering if you'd given Ruby In Steel a whirl (http://www.sapphiresteel.com/), and if so what you thought of it?

I'd love to learn Ruby but I'll admit I'm a little reluctant to leave the IDE I know so well.
jodie - 9/16/2007 8:53 AM
# re: Ruby, so easy a wife can do it
hi, i know you probably don't mean to, but the title sounds very sexist
Joey Beninghove - 9/16/2007 9:22 AM
# re: Ruby, so easy a wife can do it
@Jodie,
I'm interested to know if you even read the post. Obviously the title was a joke. One which my wife approved of beforehand. Do I really have to give a disclaimer stating that:

"I understand their are a ton of women in IT that are a LOT smarter than I am. This post is meant as a joke for my many fellow guy developers out there whose wives roll their eyes at them every time they mention they saw some really nice code that someone wrote today."

If I'm in the wrong, then I certainly apologize.
Joey Beninghove - 9/16/2007 9:45 AM
# re: Ruby, so easy a wife can do it
@Joe,
I haven't used Ruby in Steel, or really anything other than just my trusty text editor for Ruby coding. Although I've always been know to crack open a .cs file in a text editor if I just need to do some quick editing anyways, so I may be more comfortable with it than some.
Derik Whittaker - 9/17/2007 8:12 AM
# re: Ruby, so easy a wife can do it
WARNING – Acting as a Arrogant Developer Here – Warning

@Joey,

I vote for lines 1 in both examples. If code were simple to write as well as simple to read then what I do would be less valuable. How can I show off my superior brain power, how I can I prove my worth?

Ok, all seriousness. I have never used Ruby (want to, just not much time yet), but if writing code in Ruby is like ‘english’ (plug in any conversation language here) then it would be much easier to code as well as debug.

I look forward to reading your ‘book’ on agile in Ruby.
john - 8/15/2008 12:23 AM
# re: Ruby, so easy a wife can do it
I liked the second example with the loop, however, I cannot agree with the first. 1.hour.from_now doesn't mean the same as AddHours(1) IMO.
Post Comment






Please add 1 and 5 and type the answer here: