V
V
Vitaly Stolyarov2017-12-16 20:13:53
JavaScript
Vitaly Stolyarov, 2017-12-16 20:13:53

How do you document your JS code?

In one of my libraries, I would like to document some parts of the code that not everyone will understand in relation to the subject area, but only some for the following reason:
- the main code is completely self -documenting
- a one-line comment is not enough, and some other text descriptions
In the first case, you can follow the tutorial for the library (if you have questions about the subject area), otherwise everything should be clear even for those who can read the code.
The second one is more difficult. It is necessary to somehow comment on the code separately so as not to oversaturate it with unnecessary text, and as already mentioned, there can be not only text descriptions. And writing this next to the main documentation for the project is not right, since it will be more useful for contributors, not users.
Are there any tools for writing comments to the code separately from it, but with a integrity check? To suggest what's new in the code and offer to comment on it, and control changes
PS If someone wants to object to self-documenting code, then here is a reverse example.
The line is especially interesting:

var Tag = function(id, description, min, max, plc) {

What is the point of wasting time writing such comments? Unless you specify the type, but in my case there is for transform-flow-strip-typesthisBabel
@param {String} id - The ID of the Tag.

Waste of time, if it is already clear from the code that the first parameter is an identifier for creating a label

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
oh, 2017-12-16
well @AnneSmith

I generate a list of all objects by their id and their corresponding functionality, very convenient for debugging, you can immediately see a list of functional objects that could cause an error
in the comments I write details that I myself can forget over time, such as why you need to do it this way, and not otherwise, a reference to another part of the code that is related to this logic
or describes the essence of the functionality, if the name of the method cannot be unambiguously understood

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question