Anyone who says "code should self-document what, comments should document why" probably doesn't write code as clearly as they think
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Code should self-document what it does, comments should document why it does it.
-
You also need to comment the "what" of the code when it's complicated. For example I have no idea what any of this does https://github.com/yarnpkg/berry/blob/master/packages/berry-shell/sources/index.ts#L185-L245 … despite the variable names being fairly clear
- 6 more replies
New conversation -
-
-
Agree. Also they miss the point. Comments should explain WHY not WHAT
- 1 more reply
New conversation -
-
-
wait hold on let me make popcorn to watch Twitter's next hot dev topic
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Comments always lie. Code should document itself.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Self documenting <> self explanatory. Documentation is meant for the clients. Comments for internal purpose are +90% code smells.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
What is "complicated" code vs "not complicated" code? Is it possible that this may be a subjective experience which varies according to skill and cognitive performance?
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 