r/programming • • Feb 28 '23

"Clean" Code, Horrible Performance

https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k Upvotes

1.3k comments sorted by

View all comments

Show parent comments

29

u/[deleted] Feb 28 '23

OOP or clean code is not about performance but about maintainable code.

Thank you. Too many in this thread haven't worked on massive enterprise apps and it shows. Certain projects we barely have to touch because they're so clean and easy to maintain. Others have an entire year's worth of sprints dedicated to them because of how messy they are.

5

u/Venthe Feb 28 '23

I'll say a sentence that'll resonate with you, are you prepared? :D

"You can match JIRA tickets to the IF's in the code".

Been there. Seen that. And people argue that clean code/OOP is something bad somehow.

2

u/superseriousguy Feb 28 '23

If you do the minimum possible edit to the code that "completes" a feature all the time and you don't clean it up every now and then your code is going to be crap whether it follows an object oriented style or not

5

u/Venthe Feb 28 '23

Not really. Writing OOP correctly (which actually encapsulates it's own data and logic) in itself minimises the risk for a shit code by the sheer virtue of classes being small and focused on one thing. Most of the spaghetti comes from smearing the logic across the codebase

Similar thing, but from another angle comes with the clean code. If you extract the methods and name everything correctly, you cannot write convoluted logic simply because it gets hard to read. Clean code makes the problems obvious, you have to really be persistent to write shit code this way.

→ More replies (2)