The Artima Developer Community
Sponsored Link

Java Community News
Get Medieval On Your Code

1 reply on 1 page. Most recent reply: Nov 21, 2006 2:36 PM by Frank Sommers

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Get Medieval On Your Code Posted: Nov 21, 2006 2:36 PM
Reply to this message Reply
Summary
The last few years have witnessed the birth of many code-quality tools that rely on static analysis of code, such as FindBugs and PMD. The oldest of such tools, however, is the compiler itself, and recent Java compilers offer a plethora of options to generate code quality-related compiler output, according to Tom Ball's latest blog post.
Advertisement

Static analysis allows code quality tools to recognize patterns that indicate bugs or other coding errors. Agile practices suggest that finding and fixing such bugs early in the development pays dividends by raising the quality of the code base.

In a recent blog post, Get Medieval On Your Code, Sun engineer Tom Ball suggests that you take advantage of the most readily available code quality tool, the compiler itself:

[If you] enable all compiler warnings and tell the compiler to treat them as errors, all of a sudden, those "minor" cleanup issues one never has time for now demand immediate attention. This actually saves time in the long run, because once you go through the work of cleaning up all the existing warnings, any new problems can be quickly caught while the new code is being developed (rather than having to scramble after the product ships).

Ball notes that Java compilers have an extensive set of warning messages that can be enabled:

In Java 5 the javac compiler added the -Xlint option with several types of checks, which were significantly expanded in Java 6. The Jikes compiler has a similar option called pedantic compilation (+P).

With the new Java Compiler API, JSR 199, developer tools will increasingly integrate with the compiler, for instance, by compiling code while the developer types in the editor, keeping a constant binary tree of the code in memory. That feature is already implemented in the upcoming NetBeans 6 release. Once the compiler is used throughout the editing process, compiler warnings can give instant feedback on new code, according to Ball.

How seriously do you take compiler warnings in your projects?


Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Get Medieval On Your Code Posted: Nov 21, 2006 2:54 PM
Reply to this message Reply
The pointer to the blog actually points to the Artima Forums page.

Flat View: This topic has 1 reply on 1 page
Topic: A New Puzzler from Neal Gafter Previous Topic   Next Topic Topic: Borland Spins Off CodeGear, Releases JBuilder 7

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use