"Ninety percent of everything is crap." - Theodore Sturgeon
Some recent dealings with a difficult co-worker got me thinking about this old saw and how it applies to software development. I spent some time examining what was making me so frustrated with this particular interaction and I decided it was not due to the soul-crushingly bad code they had generated, but their absolute insistence that it was excellent.
This post isn't about the quality of that person's code nor is it about my own prima donna tenancies about code. It's a call to action for you, and more specifically me, to produce code that is "less bad". To that end, I've come up with four steps to producing less sucky code:
- Recognize that your first (or second, or third) solution to the problem might not be perfect. This goes back to Sturgeon's Law. The "ninety percent of everything" applies to your code as well. There are vanishingly few pieces of code that as so good that they cannot be improved. Accept that most, if not all, of the code you produce could be better. Also recognize that there are few situations where aspiring to perfect code is actually appropriate. There's a big middle ground between "awful" and "perfect".
- Take extra time to clean up your code. There are always deadlines to be met and schedules to be kept, but spending an extra hour or two on a piece of code to rename variables, restructure for readability, and generally refactor your code to make it better is not generally going to sink the ship. Spending that time in small increments has huge paybacks. Your future self will thank you for cleaner code and management will be unlikely to notice that you finished the task at 4pm instead of 1pm.
- Accept feedback and take it to heart. Unless you're working with a bunch of sociopaths, if someone takes the time to review your code and has a comment on it, pay attention to it! That reviewer spent time and effort to do you the favor of trying to make your code better. Even if the point they're making is incorrect, spend some time considering that maybe it's not. They may have visibility into parts of the system that you do not.
- Finally, be kind. These are tough times, but they're always tough times. Be kind to your co-workers. Try to read their feedback with good intent rather than assuming negatives. Try to be gentle in the feedback you give. And be kind to yourself. Being a member of a highly functional team is one of the greatest experiences of my career. Kindness and respect are the foundations of that type of team
As I said above, this is mainly a way to get my thoughts out and remind myself of what's important, but I hope you find it useful as well!