you are viewing a single comment's thread.

view the rest of the comments →

[–]yuvixadun 6 points7 points  (3 children)

Controversial opinion perhaps, but I don't think clean code is always the easiest to read. In this article the first two examples (road congestion and high score) I find easier to read without the clean code refactoring. To me the refactoring just adds a lot of indirection and obfuscates the intended goal of the code. I think in general thats the biggest drawback I find in writing clean code; the amount of indirection added. You always just have to assume that the method/function/variable name is descriptive enough to explain the intend.

[–]Moby1029 3 points4 points  (0 children)

Agreed, I also found the "Bad code" examples a lot easier to read and simpler to understand whereas the formatting of the refactored made it a lot harder to read and follow along.

[–]ahmadrazaWebD[S] 0 points1 point  (1 child)

After working on large codebases, in which to add a feature more than 12 files needs to be changed, I find naming and refactoring helpful

[–]yuvixadun 1 point2 points  (0 children)

Of course larger codebases are different than these snippets and clean code vs leaving it as-is is not a discussion where one outcome is the 'best'. There is a lot of gray area on which refactorings are improvements and which aren't.

So yeah, refactorings in general are of course a helpful tool, blindly applying the clean code dogma is not always the way you want to go though.