Archive for March, 2007

istp

We had an offsite/team building event today at work, and spent most of the time doing our MBTI profiles and analyzing what it meant to be this vs that. That sort of thing.

This was the 3rd time I did this sort of exercise. The first time, years ago, I was INTP. On the last two, including today, it seems that I’m really an ISTP. Though I’m borderline N (vs S), so it could change again I suppose. It probably depends on the weather.

I’m not with Einstein, though I already knew that, but I’m in good company: Malkovich, Rowan Atkinson, Frank Zappa, Keith Richards! and Woody Allen!!

Comments

Heavy metal ‘a comfort for the bright child’

Though I still listen to heavy metal, I’m no longer a child (physically at least).

When I was 13 or whatever I would bring my Black Sabbath, Led Zeppelin and Deep Purple LPs to parties. Not only that, but more than once did I bring my own stereo and threw a parallel party right next to the main party. Why I bothered going to those parties or they kept inviting me, is either a mystery or the subject for another post.

Now some people are saying that “Heavy metal is a comfort for the bright child“. Well, I’m happy to know that I was not just being a jerk, even if obviously I was begging for attention. I was also being bright.

Comments (2)

almost green means not green!

Sometimes I wish I weren’t obsessive compulsive. How am I supposed to sleep now!?

This is our code coverage after we ran rcov on it. Sure, I know, code coverage isn’t everything. It doesn’t guarantee lack of bugs or whatever. I don’t care! I just want that red pixel to go away!

Comments (1)

rcov - code coverage tool

So I’m working on this Ruby on Rails project, doing things test first of course. I’ve done things test first before, but they tended to be apis and more server kind of things. Building a web site test first was very strange to me.

I came across rcov this weekend, and here’s what it’s telling me about the coverage:

All I can say is wow!!

- wow because rcov was super easy to install and run (as it’s often the case with rails stuff)
- wow because I had never had this much coverage before. Even when running coverage tools against the “server stuff” only, let alone against the entire code base.
- wow because some of those reds were a surprise to me, I really thought I had tests for it. Well done rcov.

Comments (1)

cc.rb

The folks at Cruisecontrol.rb say it takes 5 minutes to get it up and running, including download. But really, that’s only if you have a slow connection. If you have something better than 300 baud, it takes 2 minutes. Brilliant.

Comments

rtfm is dead, long live jfgi

I was never big with the whole rtfm thing. I mean, manuals are usually boring and they force me to think. I’ve been driving for decades, I never, ever, read a manual on how to operate my car. Why would I have to read a fine manual on how to use some software?

Instead I like to tell “real noobs” that rtfm stands for repeat the first message. (I saw that somewhere and thought it was very amusing)

noob: how do i do that obvious thing?
oldb: rtfm!
noob: /whisper julio: what’s rtfm?
julio: /whipser noob: they’re asking you to repeat the first message
noob: well, “How do I do that obvious thing?”
oldb: I told you: OMFG! R-T-F-M!!!
noob: hmmm: HOW DO I DO THAT OBVIOUS THING!!?!

it’s a lot of fun. Doesn’t happen often, like everything worthwhile. But when it does it’s hilarious.

So anyway, in this day and age, we’re beyond reading manuals. Now it’s all about JFGI.

Comments (1)

Here comes trouble

(source)

Comments

Ruby’s Principle of Least Surprise

In his latest post, Sean is talking about his wow moments with Ruby. He refers to the Principle of Least Surprise which is one of the ideas behind Ruby.

His posted reminded me that I don’t cease to be surprised by Ruby. Of course if you know me just a little bit, you know that I’m easily surprised. I’m very naive and gullible. Because of it of course I’m often surprised. Often in a bad way.

With Ruby I’m often surprised too, but in a good way. Maybe Matz meant Principle of Least *Bad* Surprise?

I must admit also that my brain is half rotten by all of those years of C/C++/Java. A year or so ago, I started the process of cleaning it up by doing things in Lisp and even a little bit of Python, trying to save the 3 last neurons left. (yes, I have 6 neurons)

It’s all good but nothing like trying to solve real problems, to actually get stuff.

The surprises I have with Ruby (and Rails) are similar to the surprises I had and still have with the Mac. Like with the Mac, I now expect to be (happily) surprised. BTW, can you say you’re surprised if you expect to be surprised?

When I switched to the Mac I didn’t know how to install applications, because I couldn’t get over the fact that all I had to do was to drag an icon from here to there. That could never work, and I didn’t know what the real way was.

I was very excited (though surprised) to discover that yes, it was that easy.

The other day I had to loop through a collection of numbers and add them up. Bad Java programmer that I am, my first instinct was to do:

  def calc_sum(elements)
    sum = 0
    elements.each do |n|
      sum += n.value
    end
    sum
  end
  

Oh I knew this was bad, I knew it because of the strong odor. I just didn’t know what the good alternative was. I expected some good surprise though. (again, expecting to be surprised)

A better, more Ruby way is:

  def calc_sum(elements)
    elements.inject {|sum,n| sum+n}
  end
  

Whoa! Now, that feels great. Well, at least less Java. Then Rails comes along and makes the surprisingly elegant Ruby even better, by providing a sum method to Enumerable.

  def calc_sum(elements)
     elements.sum {|n| n.value}
  end
  

Whoa! I love it!! Least Surprise my ass.

Comments (1)