Get Conversations about InsaneCats    
Mar 16th, 2009 - Code readability
At the start of April, I'm switching 20% projects to become the head of the readability intergrouplet at Google. Basically, I'll be to readable code what I once was to testing at Google. Since so little of my 80% project is bloggable, I thought I'd use this opportunity to give you at least a little insight into some of the stuff that I'm working on.

Let's say you work for Google (welcome! here, have some pancakes) and you decide you have some code that you'd like to contribute -- there are a few approvals you need before you can submit it. For non-programmers, one of the easiest analogies for understand this stuff is that you work for an encyclopedia company and you'd like to contribute a new entry to the encyclopedia.

First, you need someone who owns that section of code to approve it. In the encyclopedia analogy, you need one of the editors of the Japan section to say that your article on Japanese Fishing looks good. These editors are probably looking to make sure that your content is correct.

Next at Google, you need to be readability approved in that language. Back to our encyclopedia analogy, the company doesn't want bad grammar to ruin a perfectly good encyclopedia. So either you, or your editor, or an additional editor you can bring in, have to be "readability approved" in French, which is essentially a certification saying that they are reasonably likely to catch any grammar mistakes in French. At least one person looking at your code (including yourself) has to have readability in the language you're working in. If you're working in multiple languages, you need multiple readability approvals.

The purpose behind this readability check is to keep a consistent look and feel across a huge and ever-growing codebase. Now a lot of these rules are ones which have no real answer: for example, can you say "can't" or do you need to say "can not"? This is something that a group of language enthusiasts decide upon and make a list of rules about. It's not that these are the right answers, it's just that these are the style guidelines that have been decided upon to create a consistent tone.

In order to actually get readability in a language, you have to undergo something called a readability review. Basically you submit a piece of code to a specially-designated readability expert in that language and the two of you go through it together to find mistakes and improve your coding style. I've done this now in Python, Javascript, Java, Sawzall and Actionscript, so I can submit code in any of these languages (with the approval of someone who owns that bit of code; the first check, remember?) without requiring any additional reviewers. If I want to submit C++ code, however, either my reviewer has to have readability in it, or I need to find an additional reviewer who has C++ readability to approve it. Once I work in C++ enough, I'll probably look into getting readability in that too in order to avoid this extra step.

Okay, so you know that specially-designated readability expert I mentioned earlier? The ones who can certify you as having readability in a certain language? So right now (before this change in April) I do that in Python. I'm one of the Googlers you can go to if you want to obtain Python readability. You can get your Python code readability approved by anyone who has passed this test. Still with me? I certify you as having Python readability (once), and then you can review someone's Python code any number of times in the future.

Now in every language we're goverened by a readability captain. So, for example, my readability captain in Python's job is to make sure there are enough of us to handle all of the incoming requests for readability tests, handle conflicts as they come up, etc.

So what I'm going to be doing starting in April is managing these captains across all the different languages. Making sure that they can do their jobs correctly, that the process is smooth, keeping the readability policies into something that actively reflects what works best for Google, helping with the infrastructure to keep this all working, and creating a sort of support community behind those who volunteer their time to help out with readability tests.

It may seem a little complicated from the outside, but all that most Googlers have to worry about is: "do I have readability in this language, if not does one of my reviewers"? And, sometimes, "maybe it's time that I get readability in this language". The rest of it is magic that happens behind the curtain.

And that, in a quick nutshell -- not to be confused with the slow nutshells -- is readability at Google. If I remember, maybe I'll post about some of my team's upcoming launches as they happen so that you guys can see what I do in my 80% time.
 

Mar 29th, 2009 - When did this happen and how do I make it go away?
I watched two kids in the park this weekend. I lay under a tree with some friends -- though I would've prefered to lie in the sun, I could feel my arms start to pinken and went to hide in the shade with the rest of them.

The kids were running around and poking each other with sticks. One had a fresh hole in the knee of her jeans (you could see the freshly scraped skin underneath), and the other had mud-stains all along the back of his pants, like he'd been skidding down wet grass. Their game, as far as I could tell, was that they lived in a colony of wild children or something and their woods were being attacked by fire and they had to save everyone.

At some point their woodland escape brought them to a small building in the middle of the park, near where we were sitting, which housed some overcrowded bathrooms. The kids pushed a picnic table against the building and the boy used it to climb onto the roof. He stood up on the roof and surveyed his kingdom.

"Jump!", the girl urged him.
"It's far", he frowned, looking over the edge. Indeed it was.
"The fire's going to get you unless you jump", the girl insisted.
The boy took a deep breath and jumped.

He fell awkwardly and I felt myself tense a little in anticipation of something horrible having happened. He lay there in a slump for one second ... two ...

I was just about to get up and see if he was okay, when he shot a fist into the air and said, "I saved them! The hunters are saved!" The girl squeeled in delight and soon both of them were up and running again. I rolled my eyes at how they were throwing themselves around with suck reckless abandon.

And that's when I realized all of a sudden that I'd become an adult. Ugh. Seriously? Eww. When did that happen? And how do I make it go away?
 

insanecats.com



CC License
Creative Commons License
Shameless hypocrisy
This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.


Archives
2009:
[Jan] [Feb] [Mar] [Apr] [May] [Jun] [Jul] [Aug] [Sep]

2008:
[Jan] [Feb] [Mar] [Apr] [May] [Jun] [Jul] [Aug] [Sep] [Oct] [Nov] [Dec]

2007:
[Jan] [Feb] [Mar] [Apr] [May] [Jun] [Jul] [Aug] [Sep] [Oct] [Nov] [Dec]

2006:
[Jan] [Feb] [Mar] [Apr] [May] [Jun] [Jul] [Aug] [Sep] [Oct] [Nov] [Dec]

2005:
[Jan] [Feb] [Mar] [Apr] [May] [Jun] [Jul] [Aug] [Sep] [Oct] [Nov] [Dec]

2004:
[Jan] [Feb] [Mar] [Apr] [May] [Jun] [Jul] [Aug] [Sep] [Oct] [Nov] [Dec]

2003:
[Jan] [Feb] [Mar] [Apr] [May] [Jun] [Jul] [Aug] [Sep] [Oct] [Nov] [Dec]

2002:
[Jan] [Feb] [Mar] [Apr] [May] [Jun] [Jul] [Aug] [Sep] [Oct] [Nov] [Dec]

2001:
[Aug] [Sep] [Oct] [Nov] [Dec]