You want to work with great code
Code that makes you grow. Code that motivates you to write great code. Code that demonstrates mastery of fundamental concepts. Code that reflects thoughtfulness and care by its creator. Code that inspires.
Code that blows the hair you have left, straight back.
But I don’t have time to write beautiful code…
Look, I get it. Projects have deadlines. Jira Tickets have point estimations. Getting something working in the quickest way possible is often a smart approach in a practical, corporate setting.
But if you find yourself always in that mindset, it’s a sign that you need to invest in yourself and grow. The lack of time you perceive for improving code is the same lazy, procrastination-based excuse you use for not doing most things you want in life.
And at first, yes, it will take you more time to write beautiful code. Slowly but surely however, you’ll start reaping the rewards of your investment, and the thoughtful approach won’t take you much longer than the indiscriminate one.
Doors start to open naturally
When someone — particularly someone more junior — uses code you wrote, one of two things happens. They either say to themselves:
- “My god, this is beautiful. I could never have written this.”
- “Oh my god, this is a total mess.”
In the first situation, the person becomes intrinsically motivated to fully understand how the codebase works to replicate it in the future.
In the second situation, someone will do the bare minimum to get a task done. Over time this leads to you as the only person who truly understands the codebase and makes it difficult to move onto other projects.
Whereas for beautiful code-writers, six months later they have people volunteering to take tasks to extend or fix their work. When the time comes for a new project, the process of transitioning off old projects is seamless.
Take inventory of the code around you
Everyone knows that thoughtful code is easier to understand, increases developer productivity, and is simply nicer to look at.
Even with this knowledge, you'd be surprised how often developers choose the quick-and-dirty approach, probably with the thought that either the project won’t be used for long, or they’ll be long gone from the team or company before the true cost of the debt-ridden code comes to bear.
While easier in the short-term, they are costing themselves opportunities for growth in the long run.
If after reading this article you look around and see a majority of “ugly” code surrounding you, here are a few suggestions:
- Establish or improve code or Pull Request reviews on your team.
- Ask or create a ticket for the next sprint to improve or refactor a piece of the codebase.
- Resolve for the next task you work on to make the code beautiful.
- And lastly, if no one at your company is producing inspiring work, consider finding one that puts more love into it.
In the same way that true runners don’t talk about how fast they could run a marathon, they simply run… And prolific writers don’t tell their friends of all the manuscripts they started but never finished, they just write…
Great programmers don’t wait for some impossible Goldilocks situation to produce beautiful code.
They code it.