Comment Computer Programming Article Index for
Comment
Website Links For
Comment
 

Information About

Comment Computer Programming




In Computer Programming , a comment is a Programming Language construct used to embed Information in the source code of a computer program. In most cases,Some programming environments include comments as one element of the language syntax that is retained for further processing, instead of discarded once recognized by the language processor. when the source code is processed by a Compiler or Interpreter , comments are ignored.Comments must be indicated in a way that allows a source code processor to recognize them as such. This is often simplified by saying comments are "ignored" (after they have been recognized and discarded) by the processor.

Comments have a wide range of potential uses: from augmenting program code with basic descriptions, to generating external Documentation .Comments can be processed in various ways to generate documentation external to the source code itself. See e.g., Comparison Of Documentation Generators . Comments are also used for integration with Source Code Management systems and other kinds of external Programming Tools .

The flexibility provided by comments often allows for a wide degree of variability and potentially non-useful information inside source code. To address this, many technical commentators and software analysts often subscribe to any of several "philosophies" and guidelines regarding the proper use of comments.


OVERVIEW


Source code can be divided into ''program code'' (which consists of machine-translatable instructions); and ''comments'' (which include human-readable notes and other kinds of annotations in support of the program code). The syntax and rules for these are usually defined in a Programming Language Specification .

Comments are generally formatted as ''block comments'' (also called ''prologue comments'') or ''line comments'' (also called ''inline comments'').1


Line comments either start with a comment delimiter and continue until the end of the line, or in some cases, start at a specific column (character line offset) in the source code, and continue until the end of the line.

  • and ---/ that can span multiple lines and line comments delimited by //. Other languages support only one type of comment. For example, Ada comments are line comments: they start with -- and continue to the end of the line.



USES


There are many different ways of writing comments and many commentators who offer sometimes conflicting advice.


Code description

Comments can be used to summarize code or to explain the programmer's intent. According to this school of thought, restating the code in plain English is considered superfluous; the need to re-explain code may be a sign that it is too complex and should be rewritten.

:"Don't document bad code – rewrite it." '' The Elements Of Programming Style '', Kernighan & Plauger

:"Good comments don't repeat the code or explain it. They clarify its intent. Comments should explain, at a higher level of abstraction than the code, what you're trying to do." '' Code Complete '', McConnell

Comments may also be used to explain why a block of code does not seem to fit conventions or best practices. This is especially true of projects involving very little development time, or in bug fixing. For example:
' Second variable dim because of server errors produced when reuse form data. No
' documentation available on server behavior issue, so just coding around it.
vtx = server.mappath("local settings")



Algorithmic description


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 = (b), f (b), f (c), f (d), f (a), ... ;
// Need a stable sort. Besides, the performance really does not matter.
insertion_sort (list);



Resource inclusion





HostApp (Main_process)