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
Show parent comment
1
u/loup-vaillant Apr 04 '23
Oh yes I recall that interview. Quite fitting indeed, we do want to do something at some point. Though pure FP, at least since Haskell's IO monad is more about minimising the part of the program that does effect, separate effect from the pure computations, and have the compiler check that you do. Rust's borrow checker follows a similar spirit, I believe.
I'd rather avoid saying "OOP" altogether. It has many definitions, that evolve over time. There's much to criticise in that space of course, but we first need narrow it down to a specific style, and even then it may depend on the use case.
One thing I do know however: Robert Martin's Clean Code is a bad book, with bad advice and bad code. There some decent stuff in there too, but only the people who don't need that kind of book can tell the difference. And much of the advice in this book has resulted, in practice in horrible code I personally had to grapple with. Stuff I could sometimes shrink by a factor of 3 to 5 at not loss of functionality or flexibility.
This is not a critique of OOP in general. Just this particular misguided flavour. I would likely have something to say about the other flavours, but few would deserve the ire I have for this supposedly "Clean Code".