Simplification . Over time, simple methods can become needlessly com-
plex. Rewriting such methods saves maintenance time and effort.
Change histories can give clues to the complexities.
Consolidation, decomposition. Sometimes, consolidation or decomposi-
tion can improve performance or improve readability. The history
might reveal why two classes were separated in the first place, and help
us decide whether to consolidate.
I prefer to keep as much of the change history as possible in the software
change control system. This approach helps keep code uncluttered and as con-
cise as possible. Many larger programming groups like to keep it in line. Either
approach works, as long as it is diligently and uniformly applied.
Many times, documentation in and out of the code shares a common purpose.
With the development of frameworks and API s, public methods can be
explained once for both purposes. Then, JavaDoc can parse the comments in
the code and produce amazingly robust documentation. The obvious benefit
is a single point of maintenance. A more subtle benefit is that it's easier to
keep an API document up to date if it's maintained with the code.
Still, some drawbacks should make us consider this approach carefully. For
example, the audience reading the code and the programmers developing the
application might have significantly different perspectives and needs. Realisti-
cally, the decision depends on many factors, including, but not limited to, the
audience, the application's shelf life, and the stability of the code base.
Tabs vs. spaces
A detail like tabs versus spaces might seem trivial, but with the increase in team
programming and publishing of code, this issue becomes much more impor-
tant. Different editors will handle tabs differently. Some editors can set inden-
tation levels and make it extremely efficient to indent and move code with the
Tab key. Others are not so rich. In addition, tabs simply behave differently
than spaces, and they can catch the unsuspecting programmer off guard.
These tips can make it easier for teams to work together, where different edi-
tors are permitted:
Pick a standard, and stick with it. Consistency is the most important
In absence of other considerations, prefer spaces to tabs. Spaces are inter-
preted the same universally. The same is not true of tabs.