In it, I write…
One of the things I get the most questions about from my students is about what the “best way” to structure code is.
The truth is, there is no best way. But I do have a series of conventions and rough guidelines that I follow.
One person strongly disagreed with me, and shared what “the best way” is, in their opinion…
- Writing code top-down
- No static initialization
- No singletons
- One export per file
These aren’t bad guidelines!
But they’re not “the best way.” They’re just “a way.”
There are of course bad ways to do things (or at least sub-optimal), but so much of what we do as developers is subjective to the person, the situation, and the code base.
As you grow in your developer career, be wary of people who position strongly held opinions as absolute facts. And even more important, but careful not to become that person yourself.
I’ve absolutely been guilty of this in the past, and try really hard to mindful of it going forward.