Wednesday, November 5, 2008

What if Obama is a flop?

Despite having not written for months, I didn't see how I could possibly let an event like this go by without comment. Far more significant than the Canadian election (even to us Canadians), last night's election says a lot about where the U.S.A. is at.

Of course, this is a very significant result. Despite a difference of only 0.1% of the popular vote, Americans actually did vote in favour of a minority for president. Unlike in Canada, where we picked the candidate that the rest of the world would look down on us for choosing, the U.S.A. picked the candidate that every other country wanted.

In a time like this, when everyone is happy and reflecting on the significance of the moment, I can't help but think of the worst-case outcome of this. What if 4 years from now the U.S.A. is still a disaster? Imagine that Obama floats through his presidency, without delivering on any of his promises, the country falls deeper into recession, the divide widens, etc. It certainly could happen. Specifically I'm thinking of a 2012 America where:

- Most citizens don't have free access to health care.

- They are still at war with (at least) three countries and losing many lives in the process.

- The sagging American economy has dragged down the entire world, such that new and emerging economies sink back to their old levels bringing many countries back to 3rd world status.

- More than 50% of Americans long for the days when a decisive Republican ran the country.

This could happen for a variety of reasons. Since every writer in the world is commenting on this election, the coming 100 days, the coming 4 years, etc. I won't comment on it here. Needless to say, despite every good intention and the rising hope of an entire nation (and arguably the world), it's entirely possible that nothing substantial gets accomplished and things operate pretty much as normal. I hope that's not the case, but it could be.

Despite the possible doom-and-gloom scenarios, this was, without a doubt, the right thing to do. This is the single biggest gift the U.S.A. has given itself and the rest of the world in my lifetime and regardless of what the next 4 years are like, I doubt anyone, from any country will be able to shake their heads and say "I told you so".

Sunday, June 8, 2008

On code reviews

One of the most valuable lessons I've learned from working at Google is the importance of code reviews. There was no mention of code reviews in school or at my previous employers, but now I can't imagine developing without it. Code reviews come in many forms but for my current project it comes down to one thing: Every piece of code must be okay'ed by at least one coder other than the code's writer before it gets checked in. That's it.

Here's a typical cycle:

1) Coder A writes code to add a small feature (or fixes a bug, or whatever).
2) Coder A shows diffs for this change to coder B (and possibly C, D, E, etc.)
3) Coder B reads through the code and notices some small logic bugs, a few style issues, and raises some other concerns.
4) Coder A fixes the issues that B brought up and responds to B's concerns.
5) Repeat 2-4 as many times as required.
6) Coder B is now happy and says so - in writing (e.g., via email)
7) Coder A checks in the change.

Sound painful? Sometimes it is. But the value added by this cycle is quite remarkable. It's extremely valuable to have people inspect the code before it gets in for many reasons, including:

1) Small logic bugs resulting from the same person staring at the same code for several minutes or hours are often caught quickly by a second set of eyes.

2) At least two people see every piece of code checked in, spreading the knowledge throughout the team and reducing the likelihood of ending up with code that only one person understands and/or can modify.

3) People are more cautious about what they check in. With code reviews, most developers do additional work to clean up, comment, and optimize their code before requesting a review in order to minimize the number of review iterations.

4) The blame can be shared among the team when things go wrong. This may seem like a small deal, but I think it's very important. No matter how careful people are, imperfect code will continue to get checked in. Without code reviews, it's easy to place the blame and this can cause animosity in the team. With code reviews, multiple people are involved in imperfect code getting checked in. This means that not only is it in everyone's best interest to make sure the best possible code gets checked in, but also mistakes become something that the team can improve on instead of just "coder A screwed up".

Code reviews add overhead, there's no question about it. But the value of code reviews is comparable to unit tests and other magic tools of software development productivity, so if you aren't using them, you should.

Wednesday, April 30, 2008

Climbing the CN Tower for WWF

A couple of weeks ago, a few of us Googlers climbed the CN Tower to raise money for the WWF. It was even more difficult than I anticipated, but it was also a great time. We raised $1480 which Google matched (giving $2960) for the WWF. If you get a chance to try it next year, you definitely should. Photo of us (post-climb) from the website here:

http://www.flickr.com/photos/saveourclimate/2433116362/in/set-72157604608762941/

Wednesday, April 16, 2008

Listening while coding

I sometimes get on these kicks where I can only work while listening to music. Other times I need silence. Lately, I'm in an unusual situation where I'm getting my best work done listening to This American Life episodes. I only recently learned about this wonderful radio show, but in the past 3 weeks I've logged well over 50 hours listening to one program after another. They have archives for the past 10 years that you can stream for free. There are tons of really interesting programs and somehow you can listen and code at the same time. Definitely worth checking out.

Monday, April 14, 2008

On interviewees' questions...

I do a lot of interviews these days and I'm always amazed at how much trouble people have asking questions. There are lots of good questions you can ask, and several bad ones. For a brief discussion of this (and a fantastic book about managing software engineers) check out Managing Humans.

Here are some bad questions (often asked by otherwise good candidates):
  • What exactly does this company/office/group do? [you should know this and so this really reflects badly]
  • How well did I do? [no way... you didn't just ask this... I don't believe it... ugh... most likely this means you did badly - if not you just lost several points]
  • How can I do better in the next interview? [are you serious? never ask this]
  • Anything about money [unless maybe you're talking to an HR person, which if I'm interviewing you, you're not]
  • I can't think of anything [nothing? nothing at all? really? you know you might have this job for the next 5-10 years; it could be thousands of hours of your life; it might keep you up at night from time to time; it might be the job you've always wanted; it might be the best decision of your life; it might be the worst decision of your life; are you sure there's nothing you want to know? really?!?!]
For me it's very simple. Ask two questions to each interviewer. Clear, concise, insightful questions. I find it easiest to ask one question about the job or a specific project/product and one about the company. And what's a good question to ask about each one? How do you know? You research it in advance! Know what your company does, come with an idea about what your job might be, and find things that interest you in these areas to ask about. If there's nothing that this company does that really interests you, you don't want to be there... really you don't.

Interviewees' questions don't make or break the interview - their answers do. Still, interviewers (especially if they're developers/engineers/etc.) like to know that their potential coworker has interesting things to say and shows some interest in what's going on. Think about it - this is probably what we want to do and we're here doing it. At least pretend you're interested.

But of course if you're just pretending... we'll know.

Saturday, September 1, 2007

Admitting mistakes

Yes, I was wrong.

In a previous post, I argued that you should clear out your inbox in the morning, evening, etc. Recently, I finished reading "The 4-Hour Workweek" (yes four) by Timothy Ferriss. Highly recommended, despite some obvious issues with his methods.

One excellent recommendation he makes is essentially this: "Do not clear out your inbox first thing in the morning." Why? Because you should have a plan for what to get done that day and clearing out your inbox does two things: 1) it takes time. often lots of time. and the morning is (for lots of people) the best time to get things done because other distractions are minimal and 2) it inevitably changes your priorities for the day. The second is the key here. I used to wake up in the morning thinking: "today I need to do this, this, and this". Then I would read my email and someone would say "can you do this for me? it shouldn't take long" and another would say "we should really do this. how soon can it be ready?" and "it would be great if we could do this today". Suddenly the 3 tasks I had in mind are replaced by other tasks (often less important) that I feel obliged to do today. So, nothing I want to get done gets done.

Over the past month I've followed Timothy's advice and not checked email until about 10am. By this point I've already got about 2 hours of work done on the tasks I really want done. In lots of cases, my work is half done by this point. Now the distractions begin, but I have about 6 hours left in my day and much of my work is already done.

This has really improved my productivity and made me feel a lot better about getting the tasks I really want done done. Recommended.

Wednesday, July 11, 2007

Embracing the present

It's been a while, I admit. But this time has been very productive. I got married and enjoyed a two-week honeymoon in the Greek Islands. Things were and are vey good.

Now I'm back in Waterloo and taking on more responsibilities at work than ever before. What does this mean? Three things:

1) More meetings - an unavoidable plague as old as work itself

2) More email - and thus more and more semi-involvement in things I really shouldn't allow to distract me

3) More mobility - in my case meaning the need to embrace technologies that I, for obvious reasons, should be using. In fact, this post is being entirely prepared on my new Blackberry Curve, not because I need to (my laptop's sitting right next to me) but so that when the time comes that I actually need to accomplish tasks like this in an airport, on a bus, or in a meeting (see #1 above), I'll be ready.

I would like to address all three of these points, but I have to say typing on this keyboard is painful beyond my wildest expectations, so let's just talk about #2. How do you/I deal with a big increase in email?

My current strategy has got me pretty far but is starting to buckle under the weight. It goes like this:

1) Keep the inbox clean. I use Gmail filters to apply labels to any mail from a mailing list. (Nearly) every mailing list has its own label, so I'm up to about 30 now. But the nice thing about this is I can always see unread counts for every mailing list. A clean inbox is a happy inbox. Personally, if after sorting through my mail there are still more than five items in my inbox (meaning I've read them but have to respond) I get nervous. I sleep well when the count is about 2.

2) Keep label unread counts near zero. This way I can easily scan which lists had recent activity. Then I go through my labels in decreasing importance/relevance to me until I've spent more than 5 minutes. After this point, I mark all the rest as read and get back to "real" work. It's possible that I would miss some things this way, but to my knowledge it hasn't happened yet.

3) Sort out all email at end of day and beginning of day. If I don't do this, email piles up so badly in between that just opening my inbox makes me depressed.

The real question for me is how to do #3. My ideal situation would be to get a treadmill, a wireless mouse, and a giant projection screen so I could read while exercising (which I absolutely can not do on a normal sized screen). Unfortunately, I'm not there yet. I just suffer through with my laptop while half-watching Hell's Kitchen.

I really do have more to say here, but my fingers are absolutely killing me.