DEV Community

Cesar Aguirre
Cesar Aguirre

Posted on • Originally published at canro91.github.io

We Shouldn't Call Them Best Practices—And Blindly Follow Them

I originally posted this post on my blog.


We, as coders, take pride in preaching and following best practices.

Don't write SQL, use an ORM.
Don't throw exceptions, use Results.
Don't write conditionals, use design patterns.

Don't do that, do this...

Those "don't do that, do this" hide all the context in which they make sense. That's the part we skip and don't tell when we preach best practices.

Recently, I had a call with a consulting company that needed help.

They were migrating a small shop's application from the early 2000s to a newer stack. It wasn't written and maintained by professional software engineers. Zero best practices. Lots of copy-pasting.

Migrating that application and bringing its owners up to speed are two different challenges. They have to maintain the application once the migration is done. Using the latest and greatest best practices wasn't an option.

Often, instead of going all in on best practices, the best path to follow is "let's do the simplest thing that can work, without doing any more harm."

We shouldn't call them "best practices," but rather "pieces of advice that worked for me under certain circumstances and might work for you too." And we shouldn't blindly follow them. Not all code is created equal and worth the same.


Starting out or already on the software engineering journey? Join my free 7-day email course to refactor your coding career and save years and thousands of dollars' worth of career mistakes.

Top comments (11)

Collapse
 
ravavyr profile image
Ravavyr

There are no best practices or standards in web development.
Just a whole lotta "experienced and not-so-experienced opinions" that people push upon each other.

If it works, and it hasn't been hacked... you win.

Collapse
 
canro91 profile image
Cesar Aguirre

Just a whole lotta "experienced and not-so-experienced opinions" that people push upon each other.

Love this take.

Collapse
 
baltasarq profile image
Baltasar García Perez-Schofield

Very true! Before a complete rewrite, let's do what we can really do.

Collapse
 
canro91 profile image
Cesar Aguirre

That's right, Baltasar. That was a lesson that took me a long time to learn. As a junior/mid-level, my urge was to rewrite everything to "make it right"

Collapse
 
baltasarq profile image
Baltasar García Perez-Schofield

I know that urge. That feeling is a bad advisor...

Collapse
 
xwero profile image
david duymelinck • Edited

It is called best practices, not must do's.
Like everything it are just opinions, like you have yourself.

Their only claim to fame is that many people tried them and they proofed their worth.
But as you mention not all best practices fit in every situation. That is like wanting to push a circle through a square hole.

In the case of the application, first do the low hanging fruit like DRYing the code and make names meaningful. And then make a plan to tackle the pain points. And further in the future make the code easier to maintain.

Collapse
 
canro91 profile image
Cesar Aguirre

In the case of the application, first do the low hanging fruit like DRYing the code, make names meaningful. And then make a plan to tackle the pain points. And further in the future make the code easier to maintain.

Love this take. That sounds like a good plan to tackle a modernization project. Thanks for sharing.

Collapse
 
shricodev profile image
Shrijal Acharya

This is very true, and often trying to build a project with all the best practices is what prevents many beginners from even starting.

Collapse
 
canro91 profile image
Cesar Aguirre

Exaclty! It's make it work and only then make it clean and fast

Collapse
 
ashishsimplecoder profile image
Ashish Prajapati

Yaa I agree with you. Most of the devs just read the practices(best practices) from internet and do it blindly without even doing proper understanding of it.

Collapse
 
sebs profile image
Sebastian Schürmann

i de-spice them by calling them 'good practices' and try to avoid the best term as well. That leaves much more room for interpretation.