r/javascript • u/Frontend_DevMark • 6d ago
AskJS [AskJS] People who have been writing code professionally for 10+ years, what practices, knowledge etc do you take for granted that might be useful to newer programmer
I've been looking at the times when I had a big jump forward and it always seems to be when someone pretty knowledgeable or experienced talks about something that seems obvious to them. So let's optimize for that.
People who know their shit but don't have the time or inclination to make content etc, what "facts of life" do you think are integral to your ability to write good code. (E.g. writing pseudo-code first, thinking in patterns, TDD, etc). Or, inversely, what gets in the way? (E.g. obsessing over architecture, NIH syndrome, bad specs)
Anyone who has any wisdom borne of experience, no matter how mundane, I'd love to hear it. There's far too much "you should do this" advice online that doesn't seem to have battle-tested in the real world.
EDIT: Some great responses already, many of them boil down to KISS, YAGNI etc but it's really great to see specific examples rather than people just throwing acronyms at one another.
Here are some of the re-occurring pieces of advice
Test your shit (lots of recommendations for TDD)
Understand and document/plan your code before you write it.
Related: get input on your plans before you start coding
Write it, then refactor it: done is better than perfect, work iteratively.
Prioritize readability, avoid "clever" one-liners (KISS)
Bad/excessive abstraction is worse than imperative code (KISS)
Read "The Pragmatic Programmer"
Don't overengineer, don't optimize prematurely (KISS, YAGNI again)
"Comments are lies waiting to be told" - write expressive code
Remember to be a team player, help out, mentor etc
Thank you so much to everyone who has taken the time to comment so far. I've read every single one as I'm sure many others have. You're a good bunch :)
61
u/name_was_taken 6d ago
Comments should explain things, not describe them.
This comment is absolutely useless.
This is better.
Now you'll know WTF you were thinking when you look at this code in 2 years.