This article presents seven techniques I\'ve developed and used in my consulting work that are designed to improve legacy code.
Tutorial Details:
Use a Stronger Compiler for Your Code
This technique calls for a tool change to a stronger compiler. While there are many Java IDEs on the market, most of them use the default Sun compiler. Unfortunately, this compiler is not as strict as it could be. Many common programming errors slip through the cracks. The following code illustrates one of these errors:
public class SomeClass {
private String someValue;
public SomeClass(final String someValue) {
this.someValue = someValue;
}
public void setFirstName(final String value) {
this.someValue = someValue;
}
}
In this example, the developer meant to change the name of the property from value to someValue. The developer did a good job in changing the instance variable and the constructor, but he didn\'t change the name of the parameter to the setter. The resulting error is that the assignment in the method setFirstName() has no effect since it merely sets this.someValue to whatever it currently is. As a result, SomeClass has a difficult-to-find logic bug. Unfortunately, the standard JDK compiler will not find this problem, but there are other compilers that will. The compiler that comes with the free Eclipse platform can be configured to look for problems such as these. It can check for assignments that have no effect, variables that are unused, and a host of other issues. Not even the expensive JBuilder product can do many of the things Eclipse does for free. For example, I had a client who was using the JBuilder IDE. When I imported the project into Eclipse, it detected some 200 bugs in 700 classes that JBuilder didn\'t find. Although this led to long debugging sessions, the project\'s code became more stable and the client\'s customers much happier. Today this company uses Eclipse as its main tool. (For more on Eclipse, check out O\'Reilly\'s just-released book on mastering the Eclipse platform.)
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Seven Low-Cost Ways to Improve Legacy Code
View Tutorial: Seven Low-Cost Ways to Improve Legacy Code
Related
Tutorials:
An instrumentation
network for weather data on the
Web
An instrumentation
network for weather data on the
Web |
A promise of easier
embedded-systems networking - JavaWorld November 1999
A promise of easier
embedded-systems networking - JavaWorld November 1999 |
Java Tip 81: Jazz up the standard Java fonts - JavaWorld
Java Tip 81: Jazz up the standard Java fonts - JavaWorld |
Java performance programming,
Part 3: Managing collections - JavaWorld February 2000
Java performance programming,
Part 3: Managing collections - JavaWorld February 2000 |
Product Review:
Kawa 4.0 -
JavaWorld June
2000
Product Review:
Kawa 4.0 -
JavaWorld June
2000 |
Solid JRun serves
up Java on a budget - JavaWorld June 2000
Solid JRun serves
up Java on a budget - JavaWorld June 2000 |
Easy Java/XML integration with
JDOM, Part 1 - JavaWorld May 2000
Easy Java/XML integration with
JDOM, Part 1 - JavaWorld May 2000 |
Performance books put to the test - JavaWorld March 2001
Performance books put to the test - JavaWorld March 2001 |
Embed Java code into your
native apps -
JavaWorld May 2001
Embed Java code into your
native apps -
JavaWorld May 2001 |
Comparison between the two major JDO architectures
Comparison between the two major JDO architectures |
Bug patrol
Bug patrol |
J2EE Connector Architecture
J2EE Connector Architecture
Introduction
If you\'ve ever had to integrate legacy data, data sources, or functionality with a new application, you\'ve no doubt faced a number of challenges: for instance, figuring out how to connect to legacy systems, m |
Seven Low-Cost Ways to Improve Legacy Code
This article presents seven techniques I\'ve developed and used in my consulting work that are designed to improve legacy code. |
FindBugs, Part 1: Improve the quality of your code
FindBugs, Part 1: Improve the quality of your code
One of the problems with code quality tools is that they tend to overwhelm developers with problems that aren't really problems -- that is, false positives. When false positives occur, developers learn |
Improve on Javadocs with ashkelon
Improve on Javadocs with ashkelon
Sun's Javadocs provide us with automatically generated, hyperlinked documentation of fields, methods, classes, interfaces, and inner classes. They are helpful in many ways, but you will soon develop a wish list that incl |
The eXo platform
The eXo platform
The eXo platform™ software is a powerful Open Source corporate portal and content management system. Users of the platform have a customized single point of access to the company's information system and resources. The use of a corpora |
Jurassic Phoenix - reviving yesterday\'s data
Jurassic Phoenix - reviving yesterday\'s data
Jurassic Phoenix is a simple solution to the problem of evolution of serialized data.
Why use Jurassic Phoenix?
The frustration
Serialization is great for persistence, because it is automatic, dynamic and |
What is Persistence Framework?
What is Persistence Framework?
What is Persistence Framework?
A persistence framework moves the program data in its most natural form (in memory objects) to and from a permanent data store the database. The persistence framework manages the |
New Technical Articles: 64-bit Programming on Solaris 10 OS for x86 Platforms
Four technical articles describe the new Sun Studio 10 software's 64-bit programming features on the Solaris 10 OS for x86 and AMD64 platforms. Important issues regarding the AMD64 ABI (Application Binary Interface), debugging, migration to 64-bits, and p |
DB Visual Architect for Eclipse
DB Visual Architect for Eclipse (DBVA-EC) is a full featured Object Relational Mapping (ORM) plugin for Eclipse that provides the industry\'s best round-trip code engineering support with Java. |
|
|
|