Pragmatic code review

Posted by Patrice Neff Mon, 23 Feb 2009

Code reviews are an important instrument to keep the code quality high. There are all kinds of schools on how to do this. For the local.ch frontend we made pre-checkin code reviews mandatory for a few core components including the Okapi framework. For all other components and applications, developers can request code reviews if they wish.

For this to work without the developers being annoyed with the process, code reviews must be super-easy. When first starting with code reviews at local.ch I tested a ton of tools. But none of them quite fit our workflow. In the end we went for LodgeIt. LodgeIt is “only” a pastebin application. But it works amazingly well for code reviews because it has some advanced functionality such as replying and then diffing the reply to the original.

Most code review tools include a way to automatically send emails to the “right” people to review the code and also allow comments per line. Not so LodgeIt. It doesn’t add yet another communication tool on top of what you already have in your company. You just get a short URL which you can send to whomever it may concern. The local.ch frontend team has a Skype channel where these links are posted with a comment of what the change is supposed to do. Suggestions with big code changes are done using the LodgeIt reply functionality and small suggestions can easily be done in the channel itself.

I’m so much in love with this approach that I felt something was missing at my new gig until I finally installed LodgeIt again today. If you want to try it out, there is a public LodgeIt installation.

Book Review: Building Scalable Web Sites

Posted by Patrice Neff Wed, 07 Jun 2006

A short while back the book Building Scalable Web Sites came out on Safari. The book is written by Cal Henderson, one of the main people behind Flickr. As I'm currently involved in building a Web application (local.ch) I was interested to learn a few lessons by the Flickr people. Okay, Flickr is not beating any speed records right now, but it's still an incredibly big application with tons of users and data.

Management review: the book is worth a read.
Technical short review: the book covers a lot of stuff a bit and nothing extremely well.

The book does not completely live up to it's title as scaling is only part of the book. It seems more to be a list of lessons learned while building Flickr.

That's also the reason for one of the book's main deficiencies: it's mostly PHP and MySQL only. But it also includes enough lessons that can be applied in other environments for it to be useful.

A short chapter by chapter review follows.

  1. Introduction: Doesn't need a review.
  2. Web Application Architecture: Interesting notes about building the architecture of your application. Including parts about hardware and networking.
  3. Development Environments: A few quick tips about using source control, deployment, testing, etc. Stuff that's covered a lot better and in more depth in many other places.
  4. i18n, L10n, and Unicode: Notes about internationalizing an application, translating, etc. If you have worked with Unicode before there is not much new information here.
  5. Data Integrity and Security: Filter all your input and output. Good for Cal that he includes this, because too many Web developers still fail at this. And many other books don't include it so all new new legions of Web developers come out without this knowledge.
  6. Email: Flickr does Email handling for moblogging. As I wrote that part for the KAYWA weblogs I know how frustrating this can be. That's why section 6.7 is titled "Mobile Carriers Hate You". All in all the chapter mainly covers dealing with incoming email including how to handle attachments.
  7. Remote Services: Interesting information about how to handle remote services and also communication in your application. I found section 7.5 particularly interesting where Cal describes an asynchronous service and how they implemented it for the photo uploads on Flickr.
  8. Bottlenecks: Preparing you for the scaling chapter. How you identify where your application is slow.
  9. Scaling Web Applications: The chapter that set the book's title. A lot of information but in my opinion it doesn't go deep enough.
  10. Statistics, Monitoring, and Alerting: Basically only explains a few tools for gathering statistics of the system. The section on alerting could just as well have been left out.
  11. APIs: How to publish your content with a few APIs. RSS, Atom and Web Services are the buzz words that describe this chapter.

All in all I have mixed feelings about this book. It's nothing earth-shattering but certainly worth a read. If you can read it online on Safari it's well worth to be added to your library for a while. If you have to shell out the money for that book, you will have to decide for yourself whether you can learn enough from it for it to be worth the money. It wouldn't have been worth it for me.