When I was an undergrad, Leetcode broke my brain. I would see top solutions of esoteric one-liners and wrongly think “how do I ever get this good?”
This is commonly called “code golfing”. It’s a fun hobby, but very far from “good code.”
Everybody (including those on Leetcode) knows this isn’t good code. In the industry, it’s the worst code one could write.
Okay, I admit - this is a pretty bad example of clever code, because it is so obviously bad. Here’s an example of a code snippet I came across in some old code that I found annoying:
However, on the other end of the spectrum, I realized eventually that the clearest code was actually the hardest to write.
It made sense retrospectively. Reviewing the code of a senior staff software engineer was much easier to follow and review compared to the code of an entry-level L3 engineer.
continue reading on read.engineerscodex.com
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.