the importance of documentation in programming
DESCRIPTION
COMPUTER PROGRAMMING 6421TRANSCRIPT
The Importance of
Documentation in Programming
Why is it important?
Without documentat ion, p rograms
may be confusing and / or make no
sense.
va r s la ying = t r ue ; va r yo uH i t = M a t h . f lo o r (M a t h . r a nd o m () * 2 ) ; va r d a m a g e T hisR o und = M a t h . f lo o r (M a t h . r a nd o m () * 5 + 1 ) ; va r t o t a lD a m a g e = 0 ; w h i le (s la ying ) { i f ( yo uH i t ) { c o nso le . lo g ("Y o u h i t t he d r a g o n a nd d id " + d a m a g e T hisR o und + " d a m a g e !" ); t o t a lD a m a g e + = d a m a g e T hisR o und ; i f ( t o t a lD a m a g e > = 4 ) { c o nso le . lo g ("Y o u d id i t ! Y o u s le w t he d r a g o n!" ) ; s la ying = f a lse ; } e lse { yo uH i t = M a t h . f lo o r (M a t h . r a nd o m () * 2 ) ; } } e lse { c o nso le . lo g ("T he d r a g o n b ur n ina t e s yo u! Y o u ' r e t o a s t . " ) ; s la ying = f a lse ; }}
?
Comment ing
Comments can be their own l ine or
added to t he end of a st r ing.
Comment ing Comments can be used as a form of pseudocode to
outline intention prior to writing the actual code. In
this case it should explain the logic behind the code
rather than the code itself.
Comment ing in various languages
Javascript / /
Visual Basic
C / * */
‘
General Rules for Comment ing
Not every line should be commented, but any line that
performs an operation should.
Any line that causes confusion should be commented.
At the top of the program there should be comments on
its purpose and scope of the program.
Another common comment is a last revised date and
version number at the top of the program.