Coding XHTML for Easy Debugging and Maintenance
X11d Review Questions and Answers
Objectives
----------
a. Utilize comments to identify different parts of your document
b. Format your code for easier troubleshooting and reading
Questions
---------
1. Name three helpful coding tactics.
2. Where are line breaks most helpful?
3. Where are comments most helpful?
4. When should a section of code be indented?
5. When should the beginning and ending tags of an entity be
arranged so there is a vertical line-of-sight between them?
6. How is a comment different from other text in a code file?
7. In (X)HTML, how are comments separated from the rest of the
code?
8. Where are comments helpful in (X)HTML code?
9. How should comments be indented?
10. What types of comments are NOT especially helpful?
11. Name two reasons why copying and pasting within your code is
a good tactic.
Answers
-------
1. Any three of the following: indenting, putting in line
breaks, putting in comments, using copy-and-paste, re-using
existing code. [X11d_b1s]
2. Between major sections of code, and to line up
structures that are similar. [X11d_b2s]
3. At beginnings and ends of structural and logical
sections of code. [X11d_b3s]
4. When it represents an entity contained inside another
entity. [X11d_b4s]
5. Whenever the entity is more than two or three lines
long. [X11d_b5s]
6. The comment, though visible in the code file, is
"invisible" to the software rendering the code. [X11d_a1s]
7. Using the characters
at the end. [X11d_a2s]
8. At the beginning and end of long sections of a
document. [X11d_a3s]
9. So that they don't interfere with the indenting of
the rest of the code. [X11d_a4s]
10. Comments that simply explain the obvious, such as what
a particular tag does. [X11d_a5s]
11. Any two of the following: it is quicker, it is more
consistent, and it reduces errors. [X11d_b6s]