8000 GitHub - greatislander/laser-eye-comments: Content for a lightning talk on code comments.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

greatislander/laser-eye-comments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Comments

  1. The public API is commented. (source)

What

Generally code comments take one of three forms:

  1. File-level comments, which provide information about the contents of a file.
  2. Block-level comments (sometimes known as docblocks), which document the API or usage of a specific function, method or class.
  3. Line-level comments, which provide inline documention of a function or method's internal operations.

Why

Code can only tell you how the program works; comments can tell you why it works. (source)

File-level comments help provide a sense of the overall structure of the project (the more complex the project, the more helpful they are). Block-level comments provide documentation for the API (for example, they often tell what input is required and what output is expected). Line-level comments can clarify complex code within a function or method, provide contextual references to external resources, and document areas where future improvements may be needed.

Code comments written according to a specification (e.g. JSDoc, phpDocumentor, or one of various Python docstring formats) can be used to automatically generate HTML or other documentation for an application.

How

0