I was asked recently in the context of my career, “what would you have done differently if you could do things over again?”
I’m a believer that mistakes are the best opportunities to learn and grow from, so I wouldn’t avoid making mistakes. But if I could go back in time and talk to my past self, I think I’d encourage a particular mindset earlier—write code for people, not machines.
At a certain point in my programming journey, I used to love being clever. “Wow, look how compact I can make my code,” “I can encode this list of possible options in binary to save space,” “I’m going to write it this way to just feel cool,” etc.
Spoiler alert, that sucked because guess who that always comes back to bite in the end? Me.
Obviously, this makes things difficult for your team as well. People who’ve never seen my code before will scratch their heads, find that the original author was me, then ping me with questions. That’s fine for a short period of time while the ideas were still relatively fresh in my mind, but fast forward a handful of years. Shit, I forgot.
There’s really no room for ego in this industry. There’s really no room for ego anywhere, for that matter. At the end of the day, yes, writing code is laying out instructions for computers, but who are you really writing for? Yourself and other human beings.
My teachers in the past always taught me to write like I’m writing so a 4th grader could understand it. The same thing applies to code. Does something prompt a double take? Rewrite it and supply a thoughtful comment. Is something just hard to look at since it’s really clumped together? Make it neat and tidy and easy to process.
Write the code for people. We’re all in this together.