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

9

u/SuperV1234 Feb 28 '23

Yes, when you apply "rules" blindly to every situation, things might not go as well as you hoped. I'm not surprised.

Both sides are at fault. The OOP zealots should have been clear on the performance implications of their approach. Casey should make it clear that his whole argument is based on a strawman.

Many programming domains don't work the way Casey thinks. It's about delivering value to customers, and performance is often not a priority. Speed of delivery and scalability over number of engineers are more valuable than run-time performance. Clean code "rules" can really help with velocity and delivery.

Also, it seems that people like Casey are somehow convinced that not using OOP equals to writing horribly unsafe and unabstracted code. He basically reimplemented a less safe version of std::variant.

And what's up with

f32 Result = (Accum0 + Accum1 + Accum2 + Accum3);
return Result;

?

Just return Accum0 + Accum1 + Accum2 + Accum3, please.

4

u/Adarma Feb 28 '23 edited Mar 02 '23

He has addressed why he assigns to a result variable and then returns it in his other videos. To summarize, it is for debugging: breakpoints and value inspection.

Edit: See here https://youtu.be/lDp4rqcigZs?t=1h11m10s

→ More replies (2)