Parenting Versus Programming

This post was written for and first appeared in the PHP Advent Calendar 2009.

Advent calendars are about Christmas, and for me Christmas has always been a time for family. This year I have recently joined the ranks of the parents among you. I am taking a short break from work and focusing on being a mother rather than being a programmer. This has led me to reflect on the similarities between parenting and coding. I present these here for your enlightenment, or so you can laugh at me.

Lesson One: Smells

Babies, like programs, are associated with a variety of interesting smells. If you try to ignore the smells associated with babies, they only get worse over time. Then the screaming starts.

It was Martin Fowler who popularized the notion of code smells. These are defined as parts of your code that do things in an ugly way, or to put it a different way, they are hacks. Typically, when we find these parts of code, our eyes begin to glaze over, and we enter a strange, zombie-like state. (This will also be familiar to parents.) In this state, we are paralyzed and thus prevented from doing anything about the smell. It is only when we emerge from the cave of code smells into the daylight of clean code that we can again be productive. I am not sure whether it is the horror of the code, a tendency to procrastinate that is endemic among programmers, or simply a fear of breaking things that prevents most people from doing something about the mess. It is always the smelliest parts of the code that are the most fragile.

The lesson programmers can learn from babies, here, is to face your smells and get rid of them as quickly as possible. Then everybody’s happy.

Lesson Two: Sleep

I have now been programming for mumble years. Not long after I started work at Mozilla, a delightful Canadian journalist asked me what it was like to work with a group of people “so much younger than myself.” While I am not actually that old, I am old enough to have picked up some skills. One of these skills is the ability to survive on 4 to 6 hours of sleep a night for extended periods. Although this is not my favorite hobby, I have gained a certain level of mastery.

Another thing I’ve learned is that surviving on 4 to 6 hours of sleep a night for an extended period makes you mildly deranged. With parenting, as with programming, it is sometimes required. When you achieve a certain level of derangement, you find that very silly things start to sound like good ideas, or they just start to happen, whether you intended them to or not. For example, you find yourself accidentally filing the baby in the filing cabinet or implementing a new framework.

This is a lesson both programmers and parents can learn from the military: sleep when you can do so safely, and as often as possible. If you can snatch a few minutes of nap here and there, it may not make you feel a lot better, but your degraded IQ will recover somewhat.

Lesson Three: With Great Power Comes Great Responsibility

When you set out to implement a new web app or raise a child — and yes, I do realize these things are not quite on the same scale — you have a great responsibility to do a good job. Otherwise, everyone who has to interact with your app or child in the future will curse your name. Repeatedly. Your baby — whether it is human or code — is totally dependent upon you to do a good job.

Lesson Four: It Takes a Village

On that note, it is important to realize that it is very hard to raise a child or write a web app completely on your own. Some things are better done with a little help from your friends. Whether that help is providing a role model, a shoulder to cry on, advice when you just don’t know what to do, or purely someone to vent to, it really helps to surround yourself with people you can rely on.

That summarizes the commonalities between parenting and programming that I have learned over the last 7 weeks. I suspect I have a great deal more to learn.

One final note: If anyone approaches you to work on a web app that will take 18 years, run away as fast as you can, and do not look back.

Seven Things

I feel like I’m about last to the party, but after getting tagged by Ben Ramsey I thought I’d contribute to this meme/tag/whatever that’s going around the PHP community.  I intend to blog more in 2009, so this is a starting point anyway.

Seven Things you didn’t know about me:

1.   I learned to program in the 4th grade on an Apple II, in LOGO.  A high school near me had a program where a group of selected nerds from local schools would go there once a week and share two machines.  I was the only one in primary (elementary) school.

2. I used to do a lot of singing - school choir, madrigals, musicals, an a capella group with my friends, and a youth gospel band.  I sing alto.

3. I’m not religious and consider myself a (non militant) atheist.  We were raised that way since my family is a combination of Catholic, Jewish and Presbyterian and my parents didn’t believe in organized religion.  Despite this I went to an Anglican girls’ school for 11 years (also see the above mentioned gospel band) and am technically Jewish.

4. I met my husband Luke Welling in Advanced Software Engineering at college (RMIT University in Melbourne, Australia).  We had to do a review of each other’s code as part of an assignment.  The first words he ever said to me were, “This is crap.”

5.  I moved house every 1-2 years when I was a kid, left school at 16, went back at 19, and then spent far too much time nerding out at college, which I loved.

6.  I’ve been riding horses since I was four years old.  At four, I rode my Shetland pony Froggy through the house to annoy my mother.  (I believe I succeeded.)

7.  I sold my first article to a magazine when I was about 13 years old.  It was a light humorous piece about the challenges involved in buying a horse and was printed in a national horse magazine.  (I always wanted to be a writer when I grew up…or possibly a veterinarian…or maybe a secret agent.  I never thought it would end up being tech books that I wrote.)  I have also written one complete bad novel, and the beginnings of several others.  (Nanowrimo, I’m looking at you.)

OK, now here are my tag-ees.

Tag-wise, here are the rules:

  • Link your original tagger(s), and list these rules on your blog.
  • Share seven facts about yourself in the post—some random, some weird.
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.

A Year at Mozilla

This week marks one year I have been at Mozilla.  I’ve always found milestones a good time for reflection, so I tend to think back around these times.

Since I started at Mozilla, I’ve been lucky enough to work on some great projects, including:

- Developing the AMO (http://addons.mozilla.org) API, used by Firefox 3 for the Addons Manager

- Scaling SUMO (http://support.mozilla.com) in preparation for Download Day

- Leading development for SUMO

- Helping plan the PHP5 migration for our web properties, and migrating AMO

- Working with Chris Pollett on full text search for AMO

- Working with Jacob Potter, one of our awesome interns this summer, on Melanion, our loadtesting webapp

- Working with Legal on an upcoming project

- Designing and planning a Single Sign On solution for all of the Mozilla web properties.

There’s been a lot of travel including to the superb Firefox Summit at Whistler, which was one of the highlights of my year.

I’ve also been pretty slack about blogging over the last year, I note, because some of these things really deserve their own entries.

The Mozilla firehose takes a while to absorb, but finally it dawns on you that this place is really really different from other companies, and in a very good way.  John Lilly was calling it “chaord” which is an excellent description - pushing control and responsibility out to the edges.  In some ways it reminds me of academia, with regard to both the autonomy we have and the rigor in the way we do things, in other ways the organic anarchy of many other Open Source projects.

I’m also really lucky, and feel privileged, to work with such a good group of people, both in my own team and in the whole of the organization.

On a more personal note, I’m a much happier person now than I was when I started this job.  I don’t think I’ll ever be the same person who came to the USA for three months three years ago, but I guess time changes everyone.  (Even this year hasn’t been straightforward or quiet on a personal level, but it’s been easier.)

Here’s to many more years of good work with the good people at Mozilla.

A rare and special day

Yesterday was one of the best days I have ever had.

We rented a car and drove from Portland through twisty mountain roads (all alike) to Nehalem State Park on the Oregon Coast.  Luke and I were guided on our adventure by Wendy, her daughter Blake, and helper Tracy from Northwest Equine Outfitters.  (Wendy started running trail rides because she is a quarter horse breeder, and the horses needed to help with the bills.)

After mounting up we rode through the dunes and scrub of the state park, past deer, and giant gulls.  A mist of rain freshened our faces as we cantered over the sand and down to the beach.  What I thought at first was a pile of rocks turned out to be the local seal colony, some dozing idly, others keeping a watchful eye on us, with tails raised.

We dismounted at the beach and left the horses.  Wendy called for a ride and a tiny boat, with pirate flag astern, came speeding across the estuary to pick us up.  We sailed past the seals - a bit closer this time, so we could see their black little eyes and long whiskers - and then crossed the water to the Jetty, where we bought freshly caught clams, crabs, and oysters.  The fishermen steamed the clams and crabs for us, while we took our oysters to the campfire and cooked them over the open flames. The oysters were the biggest I have ever seen - the meat in each one the size of two hands.  Wendy basted them in a mix of butter, garlic, chili powder, hot sauce, and lime juice.  We sat on giant seats carved out of thousand year old trees around the camp fire, patted the dogs, ate oysters til our fingers dripped with juice, and heard stories of great courage and being lost at sea.

Eventually we sailed back over the water and were reunited with our horses.  We rode down the beach for a couple more hours, returning at last, exhausted and sandy, to the corrals.

Write Beautiful Code at OSCON

I gave my talk yesterday at OSCON 2008, and here are the slides.

It’s interesting - I think every time I have given this talk I focus on a slightly different aspect. Yesterday it was the importance of decoupling parts of your application architecture as much as possible. This is better for security reasons (allows paranoid coding practices), for scaling (allows you to switch out and/or scale components independently and quickly), and for maintainability.

OSCON is good as usual - if you’re here be sure to join Mozilla at Beerforge tonight, and come say hi.

Why Open Source rocks

The interview I did with Bruce Byfield at OpenWeb Vancouver has been posted on linux.com.  In it, I talk about why Free and Open Source Software makes for better programmers, how to make developers happy, and explain why all the passionate people at Mozilla make it a cool place to live.

Foxes

We have a litter of fox kits in the back field at our house.  Today we managed to catch them on film.  Please enjoy our very own foxkehs.  :)

Foxkeh?

Edited to add: Some people apparently don’t know Foxkeh…for comparison:
Foxkeh,  (C) 2006 Mozilla Japan

You can view the whole set here:
http://flickr.com/photos/lauraxthomson/sets/72157605003262452/

Blog relocation

After a bunch of DNS and other broken-ness issues, I have given up on TypePad and moved my blog to self hosted WordPress.

Some links are still broken (notably About and Talks) but I’m working on that and hopefully they should be fixed soon.

Links to specific posts will also be broken, but they are all here somewhere.  (If I get time I might put in a bunch of rewrite rules but I’m not sure there are enough links into specific posts here for that to be worth it.  Tell me if you have specific requests.)

Firefox 3 Beta 3 Add-ons Manager and Add-ons API

Yesterday the beta 3 of Firefox 3 was released to the world.  This beta contains the new Add-ons Manager, and people seem to be liking it so far - ArsTechnica says

One of the most promising and impressive new features in beta 3 is an
integrated add-on installer system that allows users to search for and
install add-ons from addons.mozilla.org directly through the Add-ons
Manager user interface.

The new Add-ons Manager is the result of collaboration between a bunch of smart Mozilla people - Madhava Enros and Dave Townsend to name two - and a small contribution from yours truly. 

The Add-ons Manager pulls data about Recommended addons and search results from the main addons.mozilla.org (AMO) website via the AMO API, which is my project.    When you ask for a recommendation, the Add-ons manager pulls a RESTian URL like

https://services.addons.mozilla.org/en-US/firefox/api/list/recommended/all/

checks for addons that you don’t yet have installed from that list, and displays details of the remaining addons.

The API will be (is) available to the community as well, and promoted once testing is complete.  If you’d like to experiment with the API then draft documentation is available at
http://wiki.mozilla.org/Update:Remora_API_Docs
(This will move to the Mozilla Developer Center once it’s more fleshed out.)  Please file any bugs you find.

I’m still working on tweaks and bug fixes: I’ve already fixed a bunch of character encoding issues in different languages, and applied some performance tweaks. (Some still to go into production.)  Right now, I’m working on speeding up search.  Search is slow on the whole of AMO, and later this year I plan to implement a full text search.  Right now it’s just tweaking - it’s slow because when you search all the possible translations are searched (think many left joins), and the plan is to rejig the database to only search your local translation plus English (since many add-ons are only available in English, and we wouldn’t want you to miss out).

Anyway, it’s been great fun working on this project so far, and it’s incredibly rewarding to think that something I wrote is incorporated into my favorite browser. 

Frameworks, Addons, Firefox, busy busy busy.

I’m about to leave for Orlando where I will speak at CakeFest One tomorrow on the subject of building the addons.mozilla.org API using CakePHP.  The whole of the addons.mozilla.org website is built with Cake, and we believe it to be the biggest installation (in terms of traffic) in the world.  I’ll post slides after the presentation, and a bit more information about the numbers and so on.

Building the API has consumed my thoughts for the last few months.  It’s used by the new Addons Manager in Firefox 3, which will be in beta 3.  (You can read Madhava Enros’ blog entry on the subject for a preview).  After beta 3 is out, I plan on blogging more about the API details.  I’m still ironing out bugs and doing some peformance tuning.

In addition to my involvement with Cake these days, I have recently been associated with two new framework books.  I acted as a tech reviewer for Mike Naberezny and Derek DeVries’ "Rails for PHP Developers" (Pragmatic, 2008) and wrote the foreword for Cal Evans’ "Guide to Programming with Zend Framework" (php|architect, 2008).  These books are now available, so please enjoy the fruits of the authors’ labor.

I can’t help but find it amusing that something I’m (in)famous for not being a fan of has dominated my professional life for the last six or so months.  I’ll have to write more about my thoughts on these three frameworks soon…but right now I’ve got too much work to do :) and a plane to catch, besides.