Archive for the ‘Uncategorized’ Category

Optimising for Iteration

Monday, February 27th, 2017

Mark Zuckerberg in front of a Move Fast poster

Late last year I left Facebook, but I still like to follow what’s happening inside the company’s multicoloured walls. So last week I watched with interest with Mark Zuckerberg laid out a long-term vision for Facebook that focused on building meaningful communities and influencing the real world.

This plan seems to be both a reaction to the US election and resulting political drama, and an attempt to capitalise on the more serious tone that Facebook discussions can take compared to networks like Instagram and Snapchat.

Whether this approach will work as a product is an open question. It might take Facebook some time to get right. But they have repeatedly shown a willingness to push an idea until it either runs out of steam or takes flight. Even successful products like Messenger or Ads have seen years of continual iteration.

Technology choices that matter

It’s tempting to chalk up Facebook’s ability to to ship products quickly to the company’s size. And of course a lot of engineers can write a lot of code. But the Mythical Man-Month has remained a cliche in our industry for a good reason: it’s easy to drown in the overhead of communication and technical debt.

Facebook has remained nimble despite it’s size, not because of it. And this nimbleness has required deliberate cultural and technical choices. Many of these choices — like monorepos, or a reluctance to ditch PHP — are at odds with industry best practices, but have been the right call for a company optimising for speed.

Homogenous tech stack

Shipping a product at Facebook is as simple as committing JavaScript and PHP files to a monorepo. Engineers don’t have to worry about setting up continuous integration, hosting, deployment, configuring databases, or caching layers. These common elements are already built and are well maintained. Engineers just only to worry about building the unique parts of their product, and when they change teams they can reuse their knowledge on different products.

Continuous, gradual, code improvement

A homogenous stack doesn’t have to mean a static one. Engineers at Facebook often use automated codemod tools to update all the consumers of an abstraction as it changes. This drops the incremental cost of maintaining additional products close to zero.

Small, flexible primitives

The common abstractions that are available to engineers are fine grained and can be composed in novel ways. The prototype for Timeline was built in a single night by reusing existing abstractions.

Many mature products are backed by standalone services, like a fast index for Search, or custom storage systems for Messenger. But even for these products the business logic lives primarily in the PHP codebase, and can be changed with relative ease.

Focusing on impact, not the code

Each organisation, and even the company as a whole, has an overarching goal and set of metrics that use to guide their work. Shipping a project means nothing if it doesn’t make the product and corresponding metrics better.

Teams are steered away from thinking something is “done” when the initial release is ready to roll. Facebook Search took years to get to two billion daily searches after the launch of Graph Search. They got there by improving the product in response to user feedback instead of doubling down on the original product vision.

Takeaways

Being able to quickly iterate on products is just one quality that defines a code base. Other organisations might prioritise performance, or code size, or stability. But the important thing is to choose something that fits the needs of that organisation. Optimising for the wrong dimension can lead to wasted effort, or even worse, hurt the products they build.

When working with a new code base I like to ask myself how the abstractions and team structures facilitate iteration. Could we build and ship a project without spinning up a new project and team? Does the code we write today becomes an asset or a liability in the future? And how could we reduce the number of cross team interactions that have to happen to ship a product? Often with a little careful planning we can leave our future selves in a much better state.

Image credit: Mike Deerkoski

Jumping On the Bandwagon

Thursday, February 17th, 2011

Nokia and Microsoft’s deal has been getting a lot of press in the last week. Nokia Plan B (which has now been revealed as a hoax) got a lot of attention on Hacker News and spawned a bunch of knock offs which I was taking a look through on my morning train ride. By the time I’d got to work I’d decided to contribute my own poor sense of humour to the mix and set off on the quickest web page launch I’d ever done. The result was Nokia Plan XP which was put together in the time it usually takes me to get my morning coffee. (more…)

Inheritance and Mootools Mixins

Friday, February 11th, 2011

I was playing with Mootools’ Class implementation today. It has a few nice features like mixins, easy inheritance and sane parent method calling. I did run into issues combining mixins (through the Implements keyword) with parent method calling. The following code fails with the message: The method “setOptions” has no parent. (more…)

Top trends of 2011

Monday, January 31st, 2011

Brightlabs, my employer, regularly publishes a web-focused newsletter for small businesses called enlighten. The latest edition contains and article I wrote detailing “Five trends that will change the web in 2011“.

The web ceased long ago of being a mere tool for sharing text documents. Images, sound and interactivity via JavaScript have all shifted the web towards the multimedia future we have long been promised. At the same time the iPhone and its App Store have raised consumers expectations of what their web enabled devices are capable of. Web developers are striving to meet these new expectations and are taking their lead from the desktop to create more interactive web applications.

Read the article on Brightlabs.

Twitter will eat your URLs

Saturday, August 28th, 2010

My HTML periodic table has been getting a lot of attention on Twitter over the last few days. Because the page has a relatively short URL a lot of people have been tweeting the actual URL rather that using a URL shortening service. This has been good for me because shorteners remove the HTTP referrer and stop me from seeing where my Twitter traffic comes from.

A peek at my error logs did reveal one potential problem though. I’ve had well over a thousand hits to invalid URLs like http://joshduck.com/perio. These are obviously URLs which have run up against Twitter’s infamous 140 character limit and have been truncated. This results in wasted traffic for me and a waste of time for my visitors so I decided to push a quick fix. (more…)

A PHP snippet for pluralizing strings

Friday, August 13th, 2010

Every time I’m working on CRUD applications it seems like a lot of boilerplate code goes towards displaying appropriate messages when lists can contain zero, one or more than one element. I put together a quick function to speed up the process.

The function takes a string with string fragments marked up inline as its main argument. It then formats the output based on the count passed into the function. (more…)

Getting started with Python and Django in 23 frustrating steps

Saturday, February 27th, 2010

Should I or shouldn’t I? Should I ditch my well-worn PHP and the frameworks I know so well to go with this new-fangled (silent-d)Jango thingy I hear the cool kids talking about? It’s a big decision, as this project is going to be the big one (you know, the one that will change the world and all that).

I’ve worked with PHP for over six years. It has it’s warts (and how) but it’s very much a known quantity at this point. On the other hand, when I have used Python it’s been a much more pleasant experience. The fact that this is a personal project makes the decision easier: let’s ditch old mate LAMPhp go with LAMPy. It’s almost dinner time and the latter sounds like it’d go well with an ale anyway. So, starting with a brand new dev box, where do I begin? (more…)

Cleaning up uncommitted subversion working folders

Saturday, February 27th, 2010

Today I stumbled across an unused working folder in a dark and dusty corner of one of our development servers. The directory had a couple of dozen un-checked in changes. Some were from barely a month ago while others dated back years. Not wanting to discard any important modifirations I cobbled together a bash command to show me when each file was last modified (the file’s mtime). (more…)

Simple Atom / RSS Reader for PHP

Monday, February 8th, 2010

I was recently looking for a simple RSS reader for PHP. There are a few out there, like Magpie RSS. These seem like adequate projects, but much too high level for the scripts I was throwing together. I need to read a couple of different feed formats: namely WordPress’ RSS feed and Flickr’s Atom feeds. I decided to put together a single-class implementation which didn’t do anything more than the bare minimum.

(more…)