Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve treatment of comments #6

Open
mjrusso opened this issue Jan 6, 2012 · 0 comments
Open

Improve treatment of comments #6

mjrusso opened this issue Jan 6, 2012 · 0 comments

Comments

@mjrusso
Copy link
Member

mjrusso commented Jan 6, 2012

There are several issues with the way that the style guide currently describes how comments should be written. In general, a literate programming style is encouraged (but certainly not mandated). However, the current guide is not compatible with said literate programming style.

The following is a summary of issues as logged by @jashkenas, moved here from ticket #2:


Ideally, improve the code to obviate the need for the
comment, and delete the comment entirely.

Actually, CoffeeScript tries to encourage pervasive commenting ... not so much to answer the "what" or the "how" of any individual line of code, but to answer the "why".

If a comment is short, the period at the end can be omitted.

Nope -- comments should be written as full sentences, with proper punctuation.


The bit that you describe as "block comments" aren't CoffeeScript block comments, which look like this:

###
comment
###

... but, the ones that you describe are always preferred instead of block comments -- which should only be used if you intend to pass along the comment to the underlying JS, like a license, or warning.


The use of inline comments should be limited, because their existence is typically a sign of a code smell.

Nope -- poor comments are poor, and good comments are good. There's no problem with writing good inline comments to explain an un-obvious function or tricky algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant