DEV Community

[Comment from a deleted post]
Collapse
 
bgadrian profile image
Adrian B.G.

Modules, classes and functions should have good comments on when to use them and how.

As for the code, beside what other said I would add

  • Any code that does not look optimal or clean code, I would explain why it got to this state, probably is an optimization or something that new devs wouldnt know
  • code that doesnt look optimal but it is, knowing the compiler rules,

ex: extracting a formula into a function for readable code a junior may refactor with the call overhead in mind, but the compiler will do that "inline func"

Basically comments are for things that are not obvious from the code, from a junior or new dev in team perspective.