Born Sleepy

Marcus Zarra’s NSConference talk today - about how reinventing the wheel is ok, maybe even to be encouraged - was thought provoking. In fact, I think it was downright provocative. Which is great :)

I recognise a lot of the sentiment behind what he was saying, and have undoubtedly had that same urge to reinvent on many occasions.

I generally feel that it’s useful to understand at least one level below the one at which you are working. If you’re using Objective C, understand C. If you’re using C, understand assembler. If you’re using an open source framework, understand how it works or the technology on which it is implemented.

And yes, it’s hard to really understand a coding problem until you’ve tackled it yourself.

Also it’s quite true that generic code is never going to be as optimal as a bespoke solution.

However…

When you use an open source library, you are typically using code that has shipped in existing products. In multiple existing products. Products that have provided the code with hours/days/months of testing with real world data. Is that worth something? Hell yes.

There is code out there which is broken, unused, or just plain rubbish. Undeniable. That’s an argument for choosing carefully, it’s not an argument for not using other people’s code.

The fact that it’s hard to understand a problem until you’ve tackled it yourself makes it tempting to rewrite. Very tempting. I have ripped out and rewritten plenty of other people’s code in my time. Many’s the time I have simplified “unnecessarily complicated code”: “what an idiot this guy is, look at all this crazy shit he’s doing…”.

That same fact is also why you really shouldn’t, most of the time. Unless you have the luxury of enough hours to rewrite the same thing more than once on the same project, or the luxury of doing the same thing repeatedly on each project. When you rewrite, you will fuck up. The fuck up rate will probably never get to zero, but it will almost certainly only reach an acceptable level after two or more attempts.

It’s uncanny how often that “weird shit” that you ripped out near the beginning makes a quiet return (with the variable names changed to protect the innocent), when the subtlety of your understanding of the problem finally catches up with that of the person who wrote the original version.

When we use someone else’s code, the trade off we’re making is to exchange that deeper understanding that we would have gained by doing it ourselves for the luxury of not having to go down all the blind alleys first.

When it comes to the risk that comes with using someone else’s code, I agree with Marcus that it’s always good to understand it.

But if you’re selling your client on the idea of doing an upfront rewrite of something now on the basis that there’s a 20% chance that they might conceivably need to do it later… well, that’s nice work if you can get it, but 80% of the time it’s stuff that they didn’t need to pay for. Sure the cost of that 20% scenario might be much worse than up-front rewrite, but there are other ways to mitigate against that worst case.

Marcus seemed to be describing a situation where you’re basically doing similar projects again and again. In that case I can also see the attraction of starting from scratch each time. Like a master craftsperson essentially making the same chair over and over again, that zen-like quest for perfection is seductive.

Most of us don’t live in that world though.

I’m not saying that we write code once and let it ossify for ever more, or that we grab the first thing off Github that looks vaguely ok and never question it again. There’s a hell of a lot of room in between that and what Marcus seemed to be advocating though.

more...

February 08, 2014

I first got to know Mark at a small gathering at his place. I was feeling shy and didn’t want to go as I didn’t really know him, but I was persuaded by Caroline, and as the evening progressed and I got to know Mark, his boys, David, Debs, Catriona and Jana, I relaxed.

At some point, RockBand was fired up. My normal option would probably have been to watch self-consciously from the sidelines, but aided no doubt by the pint sized measures of vodka and coke that Mark was feeding me, I had a go… and thus the greatest rock band never to perform a gig was born! Mark and Debs on vocals, Stu on lead guitar, me on bass - epic! The drum pads weren’t working, but no doubt we would have made do with a succession of spontaneously combusting drummers for our American tour. Or perhaps William would have stepped into the breach.

Fast forward a few months, another night round at Mark’s, many of the same faces, and an introduction to Chaz and Tracey, and Hélène. Ridiculous amounts of alcohol flowed (I think it was pints of G&T this time), much nonsense was talked. Tenuous connections were discovered, shared interests revealed, war stories from games industries exchanged, musical tastes found to be compatible! Turns out Mark and Chaz were in Colindale at the time I was growing up in Kilburn. The age gap was small enough - surely we must have passed in the street, stood next to each other in Games Workshop, jumped up and down with the rest of the Iron Maiden or Marillion crowd at Hammersmith Odeon?

Forward again, this time a barbecue at Mark’s with Nigel in attendance. Once more the world was put to rights, ably assisted by alcohol (I seem to recall Slippery Nipples featuring heavily). Another storming night. Another stonking hangover. There were more nights like this, though sadly not nearly enough. Relaxed chats in An Lanntair. Innocent meetings at MacNeils for a few drinks which magically mutated into HebSar drinking nights. A systematic assault on the HS1 cocktail menu (I blame Debs).

Each of these is a treasured (though somewhat blurry, for some reason) memory.

Yes, alcohol features heavily, but it was the easy drinking of relaxed company, not the mutually assured destruction of a search for oblivion.

I treasure them for the sense of welcome and friendship that Mark created amongst the kindred spirits he gathered around him. He had an easy generosity, and always went out of his way to help us. He also wore his heart on his sleeve, and had plenty of stress in his life when I knew him. I hope I occasionally managed to provide a sympathetic ear to him, though I wish I had done more. Somehow despite his own concerns, he always had time to listen to my troubles, offering advice and reassurance.

I only knew Mark for three years or so, and I wouldn’t presume to claim to have been a close friend, but I wish it had been much longer, and that I’d had the chance to become one.

I wouldn’t normally consider doing anything so gauche as quoting Marillion lyrics in polite company, but I suspect that Mark would let me off. There’s a bit in one of their songs about losing one of their friends in a car crash: “I remember Toronto when Mylo went down / And we sat and cried on the phone / I never felt so alone / He was the first of our own”. Death is part of life, and like everyone reading this I have lost people very dear to me. Somehow though, it feels like Mark was the first of my own.

And now I’m crying again. Bugger.

Miss you Mark.

more...

February 06, 2014
more...

August 23, 2013

It’s been a bit quiet here, but I’m still alive.

One part of the explanation is that my new job has been taking a lot of my attention. This is fab, and I’m having a great time taking Sketch apart and putting it back together again ;)

The other part is that my partner Caroline and I have recently bought a house! Moving home is of course massively time consuming at the best of times. Actually buying a property was a first time thing for me, and it’s been not only time consuming but a bit traumatic for various reasons (which mostly boil down to naivety on our part, and the potential need for some building work… sigh).

So, yes, I’m still here. Not finding a lot of time to work on Elegant Chaos projects right now, which is frustrating, but I will get there eventually.

more...

August 23, 2013

Some interesting coding guidelines from Richard Buckle (@RichardBuckle).

I’ve not read through the whole document yet, but what I’ve read makes a lot of sense.

Like all these things, much of the value comes not with slavish obedience, but with the thought that is provoked. Introspection about what we do as coders, and how we can do it better, is essential.

(oh, and thanks, Richard, for the ECLogging namecheck…)

Update: I’ve read em all now, and I can’t find anything to disagree with.

more...