Can Tools Reduce Problem-Solving Time?
A Review of ParaSoft's CodeWizard for Java 1.0 and 1.1
By Benjamin Long
Time. We all have the same amount, yet no one ever seems to have
enough. We start a task that we think is simple-one that shouldn't take
much time to do-and hours and hours or days later we are frustrated
because it is still not finished.
This scenario plagues professional developers every day. Given an
algorithm or patch of code that seems simple to implement, they go at it
with gusto and confidence, believing that they will be done in no time.
Yet somehow they manage to get stuck on simple, hard-to-find problems,
such as overlooking an uninitialized variable or hidden inherited instance
variables. Some might criticize these developers, arguing that careful,
meticulous work will prevent these difficulties; however, in practice,
these things can happen to anyone.
ParaSoft has developed a line of tools to help programmers
find and diagnose coding errors quickly. I will review CodeWizard for
Java, versions 1.0 and 1.1. Version 1.1 was just released "hot off the
compiler," so to speak. I will touch on some of the main similarities and
differences between the two.
CodeWizard for Java (CWJ) is not a compiler, but a source-code analysis
tool. Some well-known books on source-code analysis are Effective
C++ and More Effective C++, by Scott Meyers. Philosophically
speaking, CWJ is essentially Scott Meyers in a tool for Java. It parses
the source code identifying syntax errors, possible logic errors, and
violations of the best current programming practices by using a predefined
set of stylistic, design, and coding heuristics (see Figure 3.)
Code Wizard for Java can be installed on Windows 95 or Windows NT, or
Unix platforms. It can be run from the DOS command line, Unix command
line, or from the Microsoft Visual Studio environment. It integrates very
nicely into the "Tools" pull-down menu in Developer Studio. CWJ
works in conjunction with a control panel and Insra, a GUI
display.
The control panel in 1.0 is a set of four-tabbed sections: Analysis,
Suppressions, Password, and About. Version 1.1 introduced a control panel
that is also composed of four tabbed sections. In place of the
Suppressions tab, a new tabbed page called Naming Conventions is shown.
This tab allows project developers and managers the flexibility to
standardize coding styles and conventions for things like classes,
instance variables, and methods. The logic of the Suppressions tab from
1.0 is accessed via a button entitled "Suppressions," on 1.1's
Analysis tab.
Conventions Tab
Insra displays error messages and feedback from CWJ-analyzed
source file. With Insra, the programmer is presented with several
levels of functionality. It provides displaying and sorting options for
error messages, error suppression capabilities, report saving and loading
capabilities, and application editing options.
CWJ's primary purpose is to act like a microscopic filter that catches
all manner or errors and even minor inaccuracies that have been overlooked
by the compiler. It can sit on the front end of the compiler or function
stand-alone, giving developers immediate, meaningful feedback.
The error messages are composed of the class, the specific item that is
violated, the severity level or error category of the message, the source
file name, and the line number where the error occurred. The messages
also include the code responsible for the violation.
Messages are placed in the following error categories: Informational
(I), Possible Violation (PV), Possible Severe Violation (PSV), or
Violation (V). Examples of these are shown in Figure 3.
With regard to the item violated, CWJ is designed to detect errors
resulting from one of 23 various items, or heuristics, of good programming
practice. Version 1.1 upped the ante to 41 items that are checked (see
Fig. 3). The reason 1.1 has more rules is that Java is still being
developed and new rules are discovered as this development progresses.
Items that are violated in CWJ may be viewed by double-clicking on the
error message header listed in Insra
Insra also allows the developer the functionality of
double-clicking on the error message to open the source file where the
error occurred. The editor that displays the file may be specified easily
in the setup configuration of CWJ. The error may be fixed and the file
may be resaved on the spot. The developer can then reanalyze the file
immediately to observe the impact of the changes.
Because CWJ parses for many types of errors, it sometimes works almost
too well for developers; identifying too many "informational" errors that
are more stylistic in nature than application-critical. Insra, in
version 1.0, allows the developer to suppress error messages according to
error category. However, the developer must go to the control panel to
suppress error messages according to the other parts of an error message:
item, class, file.
ParaSoft fixed this inconvenience in version 1.1. Developers can now
access the CWJ Suppressions Control Panel either directly from
Insra, or from the main control panel. The newest implementation
of the Suppressions section is easier to use as well. ParaSoft added
several drop-down boxes and buttons that weren't available in 1.0. This
is an improvement over 1.0, where the programmer needed to use more
keystrokes to utilize all the available functions.
Insra sorts messages according to the error category, by file
name, or chronologically by the time when each message was generated.
Neither version displays the time, even though both can sort "by
time," so this function may not be as useful as it should be. The
different sorting options can be very nice when the programmer has many
error messages to deal with. However, this sorting is limited only to the
error message display.
Error messages can be saved in an ASCII report file for further
evaluation, processing, and storage. Report files may also be loaded back
into Insra's active display for evaluation and editing. Even if
the messages were sorted while they were in the display, they will not be
sorted in the report file. This is true for both versions of the product.
In addition, the report file contains a lot of redundant information
and is hard to read at a glance. Developers at ParaSoft tell me they will
consider the possibility of making the report files sortable and
configurable to a user's preferences in future releases.
The transition from 1.0 to 1.1 is very easy to make. The interface is
more functional and user-friendly. The product is also more functional.
The main selling point of CodeWizard for Java is that it will save
developers time because it catches errors more quickly than developers had
previously experienced.
This review appeared in the Product Review section of the July 1998 edition of Component Strategies Magazine.
|