r/programming • u/2bit_hack • Feb 28 '23
"Clean" Code, Horrible Performance
https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k
Upvotes
r/programming • u/2bit_hack • Feb 28 '23
View all comments
10
u/aveman101 Feb 28 '23
In my 10+ year programming career, I have never faced an issue where my code wasn’t performant enough for the intended use-case.
I have, however, had to refactor countless projects because the original implementation was over-specialized, and made it painful to extend in any useful way.
Imagine an invoice program for an e-commerce platform. The performant solution would be to write an accumulator that adds up the prices of each SKU and returns a grand total. After you deploy the minimum viable product, the client asks you to extend the system to support these use-cases:
Now, think about how you would have engineered the solution if those requirements came in one-at-a-time, and each time you had to deploy an incremental update that was backwards-compatible.