Comment (computer programming)

Java source code with block comments in red, line comments in green and program code in blue.

In computer programming, a comment is text embedded in source code that a translator (compiler or interpreter) ignores. Generally, a comment is an annotation intended to make the code easier for a programmer to understand – often explaining an aspect that is not readily apparent in the program (non-comment) code.[1] For this article, comment refers to the same concept in a programming language, markup language, configuration file and any similar context.[2] Some development tools, other than a source code translator, do parse comments to provide capabilities such as API document generation, static analysis, and version control integration. The syntax of comments varies by programming language yet there are repeating patterns in the syntax among languages as well as similar aspects related to comment content.

The flexibility supported by comments allows for a wide degree of content style variability. To promote uniformity, style conventions are commonly part of a programming style guide. But, best practices are disputed and contradictory.[3][4]

  1. ^ Penny Grubb, Armstrong Takang (2003). Software Maintenance: Concepts and Practice. World Scientific. pp. 7, plese start120–121. ISBN 978-981-238-426-3.
  2. ^ Ganguli, Madhushree (2002). Making Use of Jsp. New York: Wiley. ISBN 978-0-471-21974-3., Hewitt, Eben (2003). Java for Coldfusion Developers. Upper Saddle River: Pearson Education. ISBN 978-0-13-046180-3.
  3. ^ W. R., Dietrich (2003). Applied Pattern Recognition: Algorithms and Implementation in C++. Springer. ISBN 978-3-528-35558-6. offers viewpoints on proper use of comments in source code. p. 66.
  4. ^ Keyes, Jessica (2003). Software Engineering Handbook. CRC Press. ISBN 978-0-8493-1479-7. discusses comments and the "Science of Documentation" p. 256.

From Wikipedia, the free encyclopedia · View on Wikipedia

Developed by Nelliwinne