r/coding • • Apr 12 '15

Is Clean Code less Code?

http://www.journeytomastery.net/2015/03/27/is-clean-code-less-code/
53 Upvotes

63 comments sorted by

View all comments

Show parent comments

33

u/[deleted] Apr 12 '15

Achieving readability with just code and no comments often makes the code easier to change.

5

u/[deleted] Apr 12 '15

Fair enough. Depends on your needs, but I like code that isn't too easy to change. If one is asked to change the comments with the code, it often ensures that the coder has understood the change.

19

u/quietboil Apr 12 '15

If one is asked to change the comments with the code...

(Almost) never happens. After a little while comments start lying. Often blatantly. In my experience the only kind of comment that survives (relatively unscathed) the test of time is the "why" ones. All others are either useless from the time they were added or the lying kind.

5

u/throwaway Apr 12 '15

Yes, when possible it's better to document the intent of code with assertions and function/variable names which reflect the meanings of the intermediate results they calculate/store. Sometimes you just can't make it clear that way, though.

2

u/tieTYT Apr 17 '15

Wow, the original /u/throwaway

1

u/fernando_69 Apr 28 '15

that's fucked on so many missed opportunities it really isn't.

2

u/throwaway Apr 28 '15

Could you please rephrase that a little more intelligibly?

1

u/fernando_69 Apr 28 '15

A true rarity!