Advertisement
Guest User

Untitled

a guest
Sep 11th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. about comments
  2. *why* the code is doing a certain action, or why it’s doing something that is clear instead of something else that would feel more natural.
  3.  
  4. So comments can be, for me, a tool for lowering the cognitive load of the reader.
  5.  
  6. * Function comments : prevent the reader from reading code in the first place, a form of in-line API documentation
  7.  
  8. * Design comments : While a "function comment" is usually located at the start of a function, a design comment is more often located at the start of a file
  9.  
  10. * Why comments : even if what the code is doing is crystal clear
  11.  
  12. * Teacher comments : They teach instead the *domain* (for example math, computer graphics, networking, statistics, complex data structures)
  13.  
  14. * Checklist comments
  15.  
  16. * Guide comments : sole reason to exist is to lower the cognitive load of the programmer reading some code.
  17.  
  18. * Trivial comments : is a guide comment where the cognitive load of reading the comment is the same or higher than just reading the associated code
  19.  
  20. * Debt comments : I was kind of afraid that later I would no longer remember what were the entry points to do the garbage collection, so I put TODO comments, and even wrote the trigger condition.
  21.  
  22. * Backup comments
  23.  
  24. ---
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement