Chapter 4. Code Clarity


Terms you'll need to understand:

  • Code clarity

  • Whitespace

  • Javadoc

Techniques you'll need to master:

  • Writing code that is easy to read and maintain

  • Identifying sections of code that require comments to explain the code's purpose

In this chapter, you review the principles and practices that make code easy to read; this topic is referred to as code clarity . One aspect of being a strong developer is writing clean code. The compiler ignores whitespace, so it is happy to process code that has proper syntax but might be so ugly few people would care to read or work with it.

The justification for spending extra time on the project's readability comes from the assignment instructions, which highlight having a clear design that should be readily understood by junior programmers. Sun prefers a simple design to a complex one, even if the complex one is a little more efficient. Also, using custom algorithms when standard solutions are well known will be penalized . The code itself should be as clear as possible. Although "obvious" comments should be avoided, be sure that complex code has descriptive comments. For more information on this topic, please see Appendix C, "Code Conventions."



JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net