The damage of examples


This is a fantastic reminder for us, as we all love checking out code demos don’t we?

And this is inevitably damaging. These examples can be horrible in many ways – reliability, portability, security – and accessibility.

It raises a question of laziness, something for which I am a repeat offender. Code examples are how many (perhaps the majority) of us learned a great many things. I wonder how many bad habits I picked up subconsciously because pieces of example code were stripped down to the absolute bare minimum.

It makes sense to have example code be as readable as possible, as straightforward as it can be so as to illustrate the point you’re trying to make or the technology you’re trying to outline. It’s not natural to take the next step in realizing that someone is going to copy your code verbatim into production even though you said not to.