resource / Front-End-Standards

Front-end development standards for Resource.
MIT License
23 stars 1 forks source link

JS: Should describe 3 types of comment delimiters, not 2. #42

Open Krxtopher opened 11 years ago

Krxtopher commented 11 years ago

I think we should call out 3 types of comments:

This is consistent with how many editors and IDEs classify comments and more closely matches how developers should think about comments (IMHO).

Doc comment example:

/**
 * Calculates an estimated shipping cost for a set of products. If the value
 * of "products" is null or an empty array, -1 is returned.
 *
 * @param products
 *        An array of ProductInfo objects.
 * @return
 *        A number expressed in US dollars
 */
function estimateShipping(products) {
    …
}

Multi-line comment example:

/* 
This is a multi-line comment and is being used
because we're describing something a bit complex.
*/

Single-line comment example:

// Single-line comment for short notes.
nicetransition commented 11 years ago

There's a 4th type too /*! for licensing of libraries

LukeAskew commented 11 years ago

Should we also add a standard that developers should use Java Doc syntax for commenting?

nicetransition commented 11 years ago

I like that suggestion. You could just link to their how-to page

LukeAskew commented 11 years ago

I am not extremely familiar with the differences in autodoc syntax.

For JavaScript, what should we recommend? Javadoc, JSdoc, YUIdoc?

Krxtopher commented 11 years ago

Unless we're ready to standardize on an auto doc tool I don't think that we have to endorse a specific syntax in this general standards document. Regardless of which doc comment syntax is used on a project, they almost all use the double star convention to denote a doc comment.

LukeAskew commented 11 years ago

Should we wait to include the doc comment example until the syntax is standardized?

nicetransition commented 11 years ago

Yes, let's hold on that and revisit at a later time