Google Blogoscoped

Saturday, November 7, 2009

Brad Fitzpatrick (of LiveJournal, now at Google) Talks About Programming

Brad Fitzpatrick, born in 1980, started to learn programming at the age of 5. In high school he went on to create a voting booth script called FreeVote, which he says earned him as much as 27 cent per click on banner ads back then (making for 25, 27 grand per month). He went on to create blogging platform LiveJournal, thinking and implementing a lot to scale this to the traffic needs, and is currently working at Google. The following excerpt is from the book Coders at Work, in which Peter Seibel – himself a programmer – interviews many interesting programmers (some of them working at Google), asking a whole lot of interesting questions.

Seibel: You’ve done a lot of work in Perl, which is a pretty high-level language. How low do you think programmers need to go – do programmers still need to know assembly and how chips work?

Fitzpatrick: I don’t know. I see people that are really smart – I would say they’re good programmers – but say they only know Java. The way they think about solving things is always within the space they know. They don’t think ends-to-ends as much. I think it’s really important to know the whole stack even if you don’t operate within the whole stack.

When I was doing stuff on LiveJournal, I was thinking about things from JavaScript to how things were interacting in the kernel. I was reading Linux kernel code about epoll and I was like, “Well, what if we have all these long TCP connections that are going to this load balancer?” I was trying to think of how much memory is in each structure here. That’s still somewhat high-level, but then we were thinking about things like, we’re getting so many interrupts on the Ethernet card – do we switch to this NAPI thing in the kernel where rather than the NIC sending an interrupt on every incoming packet it coalesces them to boundaries that were equivalent to 100 megabits speed even though it was a gigabit NIC. We were collecting numbers to see at what point this made sense and freed up the processor.

We were getting a lot of wins for really low-level stuff. I had somebody recently tell me about something: “Java takes care of that; we don’t have to deal with that.” I was like: “No, Java can’t take care of this because I know what kernel version you’re using and the kernel doesn’t support it. Your virtual machine may be hiding that from you and giving you some abstraction that makes it look like that’s efficient, but it’s only efficient when you’re running on this kernel.” (...)

In practice, nothing works. There are all these beautiful abstractions that are backed by shit. The implementations of libraries that look like they could be beautiful are shit. And so if you’re the one responsible for the cost of buying servers, or reliability – if you’re on call for pages – it helps to actually know what’s going on under the covers and not trust everyone else’s library, and code, and interfaces. (...)

Seibel: Do you have any advice for self-taught programmers?

Fitzpatrick: Always try to do something a little harder, that’s outside your reach. Read code. I heard this a lot, but it didn’t really sink in until later. (...)

Seibel: What about code ownership? Is it important for people to own code individually or is it better for a team to share ownership?

Fitzpatrick: I don’t think code should be owned. I don’t think anyone really thinks that. The way it works within Google is that it’s one massive source tree, one root, and one unified build system across all of it. And so anyone can go and change anything. But there are code reviews, and directories have owners, always at least two people, just in case someone quits or is on vacation.

To check in you need three conditions met: You need someone to review it and say it looks good. You need to be certified in the language – basically, you’ve proven you know the style of this language – called “readability.” And then you also need the approval from somebody in the owner’s file in that directory. So in the case that you already are an owner of that directory and you have readability in that language, you just need someone to say, “Yeah, it looks good.” And it’s a pretty good system, because there tends to be a minimum of two, up to twenty, thirty owners. Once you work on a code base for a while, someone just adds you to owners. I think it’s a great system.

[Photo CC licensed by Dan Farber. I embolded the questions from the interview.]


Blog  |  Forum     more >> Archive | Feed | Google's blogs | About


This site unofficially covers Google™ and more with some rights reserved. Join our forum!