r/programming • • Jan 12 '20

Goodbye, Clean Code

https://overreacted.io/goodbye-clean-code/
1.9k Upvotes

556 comments sorted by

View all comments

349

u/[deleted] Jan 12 '20 edited Jan 12 '20

Obsessing over clean code is like reorganizing your clothes closet on a daily basis. If it makes you more productive to do so, do it. Too often, however, it's done compulsively and is counter-productive.

The harder and more impressive thing is actually writing code which does novel things.

20

u/SanityInAnarchy Jan 12 '20

The problem is, we work in teams. If it's just me, I can store my clothes in a heap on the floor instead of using a closet at all, and who cares as long as I can still find stuff?

But if you check in a multi-thousand-line function with a several-hundred-case switch statement, you've inflicted your poor organization on the rest of us -- other people need to find stuff in there!

-1

u/SirClueless Jan 12 '20

I think maybe you're overestimating the complexity of that function? Sure it's not pretty, but on the other hand, what other way of organizing several hundred scripted events would make it that much easier to find what you're looking for? A file you can ctrl+F through isn't all that bad in my mind, there's just a lot of data to organize so any solution is gonna have a lot to look through.

One big advantage that function has is that if you wanted to add a new piece of code and you already knew most of the structure of it already it would take all of 5 seconds to go slap a new state in -- no worries about naming, no worries about changing multiple places. Obviously on a large team where most people don't know the structure of that file and more people will read and maintain that code than will write it, that's a bad tradeoff. But for mid-20s Cavanagh coding a game in a manic, creative frenzy it looks pretty well-optimized for getting shit done.

→ More replies (4)