/ software development

What programming and football have in common

With the World Cup and a feast of football just around the corner (and England's inevitable exit on penalties just a few weeks further off), what better time to discuss the burning question of what programming and football have in common?

Firstly, hands up who likes programming AND football? ... Anyone? ... Anyone?

Well, for anyone still reading, let's talk about football first.

The most successful international football team of the last decade is Spain. Their run of success as Euro 2008 winners, World Cup 2010 winners and Euro 2012 winners is unlikely to be beaten anytime soon.

Let's relive the magic for a moment:

What made this team so great was how tightly they – as a team – kept the ball under control at all times. They could string together ten, twenty or thirty passes in a row without losing possession, just like they do in this clip. And they kept on doing it, searching for a weakness and wearing down the opposition.

This was something completely new in international football. So how did they do it?

By choosing the simplest, easiest option. But being able to do that flawlessly and consistently takes enormous skill.

I've played a lot of amateur football, and – how can I put this? – it's not always pretty. You see other players with a lot of bad habits. You even have a few yourself, though ideally you remain in denial about them – better a bad footballer than no footballer. The most common mistake is trying to do something clever when you have the ball. It almost never works out well. So the ball tends to spend a lot of time somewhere up in the air, aka not under control.

At school, one lad on my team would attempt a flashy trick every time he got the ball. Two seconds later, the other team had the ball. Always the same result, but still he kept attempting it. (I suppose you have to admire his persistence.)

But watch Spain here and they keep choosing the easiest option. They pass in the direction they're facing. They pass along the ground. They pass either directly to another player or into the best space for that player. Their first touch is either yet another pinpoint pass, or bringing the ball quickly under control. There's none of the long-ball-over-the-top "strategy" so beloved by English clubs.

This intense focus on simplicity and keeping tight control of the ball meant that Spain almost never made a mistake.

I've heard a lot of people (including my younger, more foolish self) say this style of football is boring to watch. That's arguably true, but if anything, that's just a further sign of how great this team was. They made it look so easy, it felt like nothing very exciting ever happened. They just passed the ball around effortlessly, and the opposition couldn't get a look-in. They wore down their opponents gradually over the course of the game. Garry Kasparov couldn't have done it better.

But making the game look this easy actually takes all the skill in the world. You need fantastic ball control to be so consistent. You need confidence on the ball. You need to be able to think fast and stay focused. You need a deep understanding of the game.

If it was easy to do, all teams would play like this. But no other international team has managed to do it, which goes to show it's way harder than it looks.


So how does this relate to programming?

Good programming is also about keeping things simple. It's about making it look as easy as possible by continually looking for and selecting the simplest option. The programming equivalent of making a great, simple pass is writing a piece of code that other people on your team – or yourself six months down the line – can easily understand and build on top of.

Is that easy to do? Absolutely not. Just like Spain you need to develop a deep understanding of the problem domain just to be able to work out what the simplest solution is, and then execute that solution with skill.

Sure, you could instead try and do something flashy and clever, but no-one on your team is going to thank you for it. You'd just be making their lives harder. You'd also piss your future self off, and you've seen yourself when you get angry – that's also not pretty.

Here at BCaster we've just begun using the front-end framework Materialize. The Materialize team have worked hard to make their framework as simple as possible to use. I'm more familiar with Bootstrap, but in every way that Materialize and Bootstrap are different, Materialize is simpler. The 12-column grid system? Simpler. Icons? Simpler. The naming system? Simpler. I went through the whole documentation in about 30 minutes and loved how easy it was to grok.

It's early days for us with this framework, but we're hoping that Materialize will be a simple and solid solution that we can build securely on. We're hoping that the Materialize team have set us up with a perfect pass for us to go and score the winning goal in the World Cup final. Or something like that.

So does that mean Materialize was easy to build? Not in the least. Just like the mighty national football team of Spain, making things look this easy takes all the skill in the world.

We should write code in the same way. We should keep it simple to make our and our teams' lives easier. But let's not forget that "keeping it simple" is actually way harder than it looks.

And every once in a blue moon, maybe we will ourselves be presented with a situation where doing the really flashy thing is the only possible option. We can enjoy that when it happens. And it does happen sometimes. Let's allow Dennis Bergkamp to explain with his left foot: