Have you ever worked with some fan of best practices? I’m sure you have. “Best practices” (from now on BP) are kind of a mantra for a lot of IT workers and when you come across one of these people, everything is about this or that document on line with a list of BP that you cannot afford not to follow to the letter if you want to have a chance to do a nice job.
If I’m writing this article it’s just because I came across many fans of BP and not long time ago it happened I had to work with a whole team of them. The reason why I’m so dramatic about it, is that, if that’s not already clear enough, I hate BP.
IT is evolving always very fast and I strongly believe that, unless you are interested in very theoretical topics, it is quite difficult to find a book or a document that is up to date, especially when it comes to the web matter.
BP documents stay untouched on the internet for years therefore becoming completely useless. If you think about the web it’s even worse considering the browser automatic update policy changed recently: the chances for changes to happen in the way browsers handle things increase every day.
Also, do you realize that the majority of BP documents online are quite rarely complete? They normally don’t cover all the aspects you might want to take care of and this leads to waste of time looking for more documents.
BP are not much different from IT books, they get obsolete before you realise it and can turn out to do more harm than good.
I know, yes, I do know what should be the point of BP… but how about using your brain instead of blindly following some checklist found on the internet and maybe read some documentation?
One of the examples that I like to mention when I happen to have an discussion about BP, is the way browsers read and interpret CSS selectors. I like it because it shows how bad things can turn if you don’t keep yourself updated and do some proper research.
Originally, most browsers if not all of them, where reading CSS selectors from left to right so everyone writing CSS had to build a selector keeping this in mind and making sure the leftmost element of a specific selector was good enough to reduce as much as possible the number of elements of the page to be checked. Well, this changed a few years ago in some browsers, so that the the selector is read from right to left: you can understand how this dramatically affects performances and how different selectors should be to perform nicely.
How did I found out this info? Googling…
hold on a sec… am I trusting a document some guy published long time ago and therefore kind of behaving like BP fans? NOT AT ALL!
You can find on the internet many instruments for you to run tests and benchmarks for you to be sure that you are going in the right direction today and to check in the future if whatever you did is still good.
My favourite tool is “JS perf“: it really helped me out a lot of times but, what’s also important, it made it very easy for me to demonstrate to BP fans why their code was that bad and to open their minds to other solutions.
This is not meant to be a guide for anyone, it is just a reminder for me to always stay up to date and never blindly follow documentation found on some bloke blog: the secret is always double check, run your own tests and don’t underestimate the importance of exploring new paths.