Lest you think that I’m over on the Emerald Isle for fun (I’m having fun, but that’s not the primary purpose of my visit), I had one of those “wait, what? oh yeah…” moments during a discussion on secure applications development.

It centred around the this analogy (edit 21:18 – given by the interviewee):

“If we taught people to drive the same way we teach people to do secure code, then we’d have a lot more dead people and destroyed cars”

I don’t know how many of you have been on a secure coding course (I’d hazard a guess and say “not many”), their tendency is to spend most of the time showing you what goes wrong (“look at how bad SQL injection can be!”), then spend a tiny fraction of that time showing you how to do it right. If we continue from our Continuing his analogy, the Interviewee said it would be akin to letting someone crash a car, and then saying “don’t do that…”.

So, my question is this… are we teaching these things the wrong way around? Is it not better to show people the correct way to handle things like user input, SQL queries, or error handling? Once we show them the right way, we can then move to show them what happens when it goes wrong. Having said that, any of these types of training guidelines would depend on the technology being used, and the associated infrastructure for reviewing the code afterwards, so maybe the answer isn’t as clear as we’d like it to be.

It’s an interesting idea, and one I’d like to explore further… if you have any thoughts, I’d love to hear from you. If I do manage to nab some time, hoping to do a session on it at Barcamp London.

Diweddaru | Update – 29/10/11

So I ran the session at Barcamp London, you can see the slides here:
An pretty good session, with a very interesting debate. Now to wait for some more feedback over the next few days.

Hwyl!

B