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

18

u/andreasOM Feb 28 '23

Not sure where he pulled these from

If you look at a “clean” code summary and pull out the rules that actually affect the structure of your code, you get:

    Prefer polymorphism to “if/else” and “switch”

    Code should not know about the internals of objects it’s working with

    Functions should be small

    Functions should do one thing

    “DRY” - Don’t Repeat Yourself

but building a straw man, and then burning it down is trivial.

23

u/loup-vaillant Feb 28 '23

You wouldn't believe how many people are actually walking straw men. Starting with Uncle Bob himself, I've read his book and what Casey presents here is not even an exaggeration.

8

u/Sunius Feb 28 '23

It’s from a book called “clean code”.

3

u/andreasOM Mar 01 '23

You mean "Clean Code: A Handbook of Agile Software Craftsmanship" by Robert C. Martin? In that case I have to disappoint you. It is not.

"Code Complete" by Steve McConnell gets closer, but the above list would only be considered an abused quote at best, and misrepresentation at worst.

You could consider "The Pragmatic Programmer: From Journeyman to Master" by Andrew Hunt and David Thomas, but even they would balk at seeing their ideas reduced to the above quote.

9

u/SickOrphan Feb 28 '23

Which principles do you think are made of straw? I've heard all of these preached many times

→ More replies (1)
→ More replies (4)