Writing clean code is what you must do in order to call yourself a professional. There is no reasonable excuse for doing anything less than your best. — Clean Code
How do you learn how to write better code?
Maybe there’s a secret book that only the experts whisper about via private Slack channels?
Or an online course or school that would teach me how to write cleaner code with less bugs?
I have read horror stories on Medium about companies crashing because their code rotted.
Functions were thrown together. Variable names were randomly assigned. Structure was ignored. Until… it was to late.
Another time I worked on a jQuery project with more than 4,000 lines of code that removed and added CSS classes to an interactive web page.
I called it cowboy code — written by a rookie that preferred frustration instead of simplicity.
So how do write the high quality code that would light up any senior developer’s face?
You could read what the experts have written.
But that’s what everyone else does.
Oh… and… before you buy any Kindle book on Amazon verify that it’s been written by an expert.
Avoid the overnight authors looking to make a few bucks on Kindle.
For example, here’s a few good ones that I’ve always enjoyed. And yes, they are written by the experts in the industry.
But books will only take you so far.
They had a good impact on my code but not the depth I was looking for.
Say, how do you learn how to write high quality code? Faster!
Find a mentor.
In case you missed it I’ll say it again.
Find a mentor. Anybody better than you to criticize your code.
“Don’t write code unless you’re willing to have other experts criticize it.” — Daniel
The proof is in the pudding
I was recently chatting with a friend of mine that manages a small development team. And I asked him his view on the best ways a developer could learn how to write better code.
Learn from a mentor.
He mentioned a college graduate that they hired awhile ago — all spiffed up with a college degree. Shirt sleeves jacked up. And ready to whip out some code.
Even so it took this freshman several years to learn how to write clean code. Something he wasn’t taught during college.
And as I write I can hear a few readers asking — “But where can I find a mentor?”
Reach out to any friends that have more experience than you. Any coder that’s worth his dough will help you out and teach you new tips and techniques.
And both of you will have fun!
Another awesome place to check out is Codementor.
Codementor | Get live 1:1 coding help, hire a developer, & more
Venture capitalist at Redpoint Ventures Within 15 min, I was online with a seasoned engineer who was editing my code…
And with that I’ll stop here so that you can go out and find someone to teach you how to write better code.
Please pound that clap button 👏 and follow me on Medium for more tips like this.