Comment (computer Programming) - Uses - Algorithmic Description

Algorithmic Description

Sometimes source code contains a novel or noteworthy solution to a specific problem. In such cases, comments may contain an explanation of the methodology. Such explanations may include diagrams and formal mathematical proofs. This may constitute explanation of the code, rather than a clarification of its intent; but others tasked with maintaining the code base may find such explanation crucial. This might especially be true in the case of highly specialized problem domains; or rarely used optimizations, constructs or function-calls.

For example, a programmer may add a comment to explain why an insertion sort was chosen instead of a quicksort, as the former is, in theory, slower than the latter. This could be written as follows:

list = ; // Need a stable sort. Besides, the performance really does not matter. insertion_sort (list);

Read more about this topic:  Comment (computer Programming), Uses

Famous quotes containing the word description:

    Do not require a description of the countries towards which you sail. The description does not describe them to you, and to- morrow you arrive there, and know them by inhabiting them.
    Ralph Waldo Emerson (1803–1882)