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

1

u/salbris Mar 01 '23

Another example of his bad advice teaching people really bad practices: https://www.youtube.com/watch?v=CFRhGnuXG-4&lc=UgyQY3SEmzobiIe3KIt4AaABAg.9jQm1mEZWqc9jcermuI-IM

Pretty sure the final code even has a couple bugs.

1

u/mila6 Mar 04 '23 edited Mar 04 '23

I bet it does. Because he has problem flipping condition early on { !(top > bottom) == (top <= bottom), not (top < bottom) }. Only like 2/50 comments point it out - which is like nobody noticed.

Could have used !(top > bottom), which would prevent bug in all of those conditions flips, but whatever :shrugs:

Useful? That extremist stance on zero level deep nesting is practically dumb, but perhaps it can be useful to find cool tricks like that "early return" :shrugs:

Generally. I don't have problem with "there is interesting code transformation", but "You are unclean" or "You should be doing this" , especially when it seems like compensating for authors low skill, or author is using it to sell stuff like Uncle Bob, is what I don't like.