Can there ever be such a thing as a “coding commandment”? Some rule that is so universally true that it should be applied in every situation?
I don’t think so. I think if you stay in this business long enough you get to watch “best practices” turn into “anti-patterns” and then become “best practices” again.
Author’s Note: The following is an excerpt from my weekly Dev Mastery newsletter. It was originally sent to Dev Mastery subscribers on September 8, 2016.
Object Oriented Programming used to be seen as the silver bullet, best ever way to code, now people are poo-pooing it in favour of Functional programming.
That’s the game, it ebbs and flows. So, what do we do? Is it realistic to start from first principles every time? Attack every problem as if it’s our responsibility to solve it from scratch and treat all other solutions or advice with a large dose of skepticism?
I think the time to be most skeptical of a particular convention or established practice, the time to challenge the status quo is when we are facing a new problem that hasn’t been seen or solved before (very rare). Or when we are trying to build a product or a company whose purpose is to disrupt an established norm.
Other than that, I think most of the time we have to rely on the best advice and guidance available to us in the moment.
Find trusted sources, engage in the community, follow conventional wisdom. But don’t become a fanatic about it. Don’t close your mind to other possibilities. It’s a tricky balance. But an important one.
On that topic, here are three links that I think you’ll enjoy.
#1. Six Commandments of Good Code
I don’t love the title, but given what we know today, these so-called “commandments” represent good practices in most situations.
This video by MPJ addresses the HTML in JS example I gave earlier. It’s a good exploration of some of the complexity and problems we have faced with web apps from the very beginning.
#3 The Cook and The Chef: Musk’s Secret Sauce
This one is not about programming, but it’s a very good read that gives you insights into where and how to apply first-principles thinking, based on the example of Elon Musk. Fair warning, this is a very long post, you may have to read it in chunks. It’s also part of an even longer series on Musk that is very worthwhile, if you have time.
The post you just read was originally sent to Dev Mastery newsletter subscribers on September 8, 2016. I send out stuff like this every week. Sign up below to get in on the action.