Following programming ‘best practices’ will slow you down

Who has not stolen a cookie from the jar when Mother was not searching?

Or stayed out with close friends extensive immediately after bedtime?

Or — God forbid — taken the shortcut by means of the park in which shady men and women lurk, rather of heading the extensive way about the main road?

Or, indeed oh sure, which programmer has not violated a single of all those etched-in-stone greatest tactics, you know, a person of the types that you should really adhere to at all expenditures?

It is risk-free to say that a lot of, if not most, of us have accomplished this right before. But possibly your rule-breaking is specifically why your code was much better than normal. At minimum it didn’t make you drop your job. Or make your pc explode at runtime.

Sure, breaking principles is never ever devoid of possibility. If you’re a mind surgeon, you really need to abide by the rule of “never lower this piece off.” (Forgive me for my bluntness, I’m no health-related professional.)

But if you’re setting up software package, what’s the worst circumstance? Certain, if you are developing killer drones or software program for electrical grids or assistance programs for spaceships you may well want to go slow and comply with the regulations.

But those programmers who don’t have significant stakes like that — and that is most of us — you might want to dilemma your rulebook from time to time.

Duplicate-pasting code isn’t the root of all evil

The die-hard open-sourcers and the die-tough purists could argue normally. But, in all earnesty, who hasn’t copy-pasted code snippets from StackOverflow and other destinations of the big large web?

Initially of all, if you have a problem that can take 5 seconds to google, you would not go annoy your coworker for ten minutes to make them resolve it. And if the remedy is on Stack, then, nicely, the solution is there.

The purists would argue that you shouldn’t copy anything since you could possibly not fully grasp what’s going on in the copied code. And they have a issue.

But if you’re googling all around in any case, you are fairly probably heading to examine the handbook web pages of the perform that you’re copying more than anyway. Additionally, you are probably going to want to modify a handful of variable names and have an understanding of where to put that snippet of code. That’s not attainable devoid of a minimum of comprehension.

An additional point for the purists is that your completely ready-to-duplicate-paste code may perhaps comprise non-printable people. These are people like a backspace or a horizontal tab that you can not see on your display screen, but that can have an influence on the output in any case.

Purists would thus argue that if you’re going to duplicate code, at minimum kind it you so you do not unintentionally copy non-printable people and make a mess of your venture.

That is neat assistance, but individually I really don’t know anyone who has at any time bumped into a non-printable character and messed up their code. I do know an individual, although, who introduces typos everywhere you go: me.

Some bugs you’ll never see with a naked eye. Image by author