Java Reference
In-Depth Information
possible powerful improvements in programming cycle time, deliverable qual-
ity, and project success. Many of these rules, outlined in table 9.1, demand
that you pay close attention to programming hygiene. For example, in XP the
entire code base is shared, and programmers have to follow strict conventions
so that anyone on the team can quickly read any line of code. Another rule is
that programming is done in pairs, which means teammates must agree on
such mundane issues as brace, tab, and comment treatments. Frequent refac-
toring mandates consistent style so that code fragments can move throughout
the code base freely. Readability is shattered if programmers ignore these com-
mon conventions.
Table 9.1
Extreme programming (XP) requires good programming hygiene to work effectively.
XP Rule
XP Rule Value
XP Hygiene Requirements
Program to com-
mon standards.
Standards are required for refactor-
ing as a team. See the next row.
Enough said.
Refactor merci-
The cost of maintaining and fixing
poorly designed code dwarfs the
cost of refactoring.
Refactoring often involves moving
code fragments throughout the code
base. For the style to be uniform, all
must observe common standards.
Share the entire
code base.
The correct solutions can be devel-
oped without regard to ownership or
“turf wars.”
If many different teams can touch a
class, only common standards can
keep the style uniform.
Move people
Programmers have better focus and
motivation. Losing one person will
not doom a project.
Changing responsibilities also
changes the set of classes that a
team will affect.
Program in pairs.
Tunnel vision is avoided, and bugs
are caught early.
Both programmers must agree on
Value simplicity.
Simple is usually sufficient, and is
much easier. Cycle times are much
Many coding conventions promote
Coding standards protect against antipatterns
While coding standards protect against antipatterns, some antipatterns cannot
survive good hygiene. Take the Lapsed Listener and Leak Collection antipat-
terns from chapter 6 and the Split Cleaner antipattern from chapter 7 . Adher-
ing to two simple coding standards helps diffuse each of these antipatterns:
Ensure that every added resource or registration has a corresponding
Search WWH ::

Custom Search