Who hasnt stolen a cookie from the jar when Mom wasnt looking?

Or stayed out with friends long after bedtime?

It’s free, every week, in your inbox.

Following programming ‘best practices’ will slow you down

Its safe to say that many, if not most, of us have done this before.

But maybe your rule-breaking is exactly why your code was better than average.

At least it didnt make you lose your job.

Article image

Or make your setup explode at runtime.

Sure, breaking rules is never without risk.

If youre a brain surgeon, you really should follow the rule of never cut this piece off.

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

(Forgive me for my bluntness, Im no medical expert.)

But if youre building software, whats the worst case?

Copy-pasting code isnt the root of all evil

Thedie-hard open-sourcersand thedie-hard puristsmay argue otherwise.

Ownership should always be a shared responsibility. Image by author

And if the answer is on Stack, then, well, the answer is there.

And they have a point.

Thats not possible without a minimum of understanding.

Another point for the purists is that your ready-to-copy-paste code may contain non-printable characters.

I do know someone, though, who introduces typos everywhere: me.

Unfortunately, there will always be programmers who leech of open-source code and pay a bitter price later.

Log4j, for example, is a piece of open-source code that parses log information to system administrators.

We dont want this to happen of course.

Or some version of this.

And questions will arise even with the best documentation.

That being said, of course you should hand off your code!

And hey,programmers burnout is real.

Thats incredibly silly because it stunts future growth.

And if theres one thing that developers want, its learning more and growing.

Also, not every code project is a free-time endeavor.

People change jobs, you know?

Now its the teams responsibility to keep the code in shape.

Also, teams shouldnt fall into the pitfall of assigning different pieces of code to different people.

Of course people will know the sections best that theyve written themselves.

The authors miss out on important feedback and fresh ideas for their code.

But it should always be ashared responsibility, where several people maintain a project.

Today this pop in of project is atextbook task.

Yes, StackOverflow, home to the gurus of programming,didnt test everything.

They didnt test very much at all in the beginning!

These days, not only is testing mandatory, but there are evenbest practices for testing itself.

Yup, you heard me right.

So whats the deal?

Dont you want to ensure that your code works?

Yes, but…Tests take time.

You dont always have time galore.

First of all, tests take time to execute.

Second, tests take time out of developers days.

Over time, this just gets expensive.

Or you only write the most necessary tests in the first place.

Need an example?StackOverflow is your friend, as usual.

But if you’re free to, just dont follow the rulebook to the letter either.

If you copy-paste a snippet from StackOverflow or any other site, you wont be punished.

As long as you understand that piece of code and are able to make the necessary adjustments anyway.

Copy-paste an whole open-source project into your own proprietary project andyoure in legal trouble.

Dont keep your copy-pasted stuff up-to-date and you might get in trouble with hackers who exploit your vulnerabilities.

Ownership, certainly single ownership, is bogus.

take a stab at assign every project to multiple people.

Learn to let go of your code projects and give them to other people.

Free your mind and your calendar for new things!

And dont test your code to death.

Test where things could go wrong, and where you suspect hackers could do harm.

Test where its necessary, and let the architecture take care of the rest.

Im not suggesting you do a 180 to everything you did.

Instead, try breaking every rule in ways that make sense for the task at hand.

you could build good things by following all the rules.

Youll build great things by following all the rules that make sense, and throwing all the rest away.

This article was originally published on Medium.

you might read ithere.

Also tagged with