Java Reference
In-Depth Information
Chapter 4. Program Understandability
Program understandability is the ease with which the program can be understood—that is,
the ability to determine what a program does and how it works by reading its source code
and accompanying documentation [Grubb 2003]. Understandable code is easier to main-
tain because software maintainers are less likely to introduce defects into code that is clear
and comprehensible. Understandability helps in manual analysis of source code because it
allows the auditor to more easily spot defects and vulnerabilities.
Some guidelines in this chapter are stylistic in nature; they will help a Java programmer
to write clearer, more readable code. Failure to follow these guidelines could result in ob-
scure code and design defects.
50. Be careful using visually misleading identifiers and literals
Use visually distinct identifiers that are unlikely to be misread during development and re-
view of code. Depending on the fonts used, certain characters are visually similar or even
identical and can be misinterpreted. Consider the examples in Table 4-1 .
Table 4-1. Misleading characters
The Java Language Specification (JLS) mandates that program source code be written
using the Unicode character encoding [Unicode 2013]. Some distinct Unicode characters
share identical glyph representation when displayed in many common fonts. For example,
the Greek and Coptic characters (Unicode Range 0370-03FF) are frequently indistin-
Search WWH ::




Custom Search