December 20, 2014
Hot Topics:

Can IDEs Do More to Improve Code Quality? Part II

  • April 28, 2004
  • By Charles-Philip Bentley and Baudouin Le Charlier
  • Send Email »
  • More Articles »

Miscellaneous Uses and Features for Comments

We have seen how to write and maintain good documentation in the source code. However, it would be pointless to make these processes efficient if there were no productive ways to benefit from this documentation. Here are a few examples of what is possible to do in the current version of Eclipse.

Non-intrusive popup window

Indeed, with minimum time wasted, Eclipse can fetch relevant documentation and display it in a non-obtrusive popup window. Take, for example, the following code snippet:

public static void main(String[] args) {
   Car car = new Car("Bob");
   String name = null;
   car.setOwnerName(name);
}

To display the specification of the setOwnerName method, one puts the insertion point inside the method call setOwnerName and presses the F2 key. One also can hover the mouse cursor over the method name for half a second. Easy access to information allows one to make sure the objects and methods are used correctly.

Generating and Displaying the Javadoc

The IDE also uses those comments to generate API documentation in HTML. A browser can be started from inside the source editor for displaying this documentation. In Eclipse, the action in menu Navigate -> Open External Javadoc will show the API documentation relevant to the object selected.

Javadoc comment Folding and Unfolding

Comments take space in the editor. Thus, once one knows a class pretty well it is legitimate to hide the comments by folding them. Code folding is scheduled for the next Eclipse release in June 2004. One can try to improve the feature by defining behavioral preferences enabling the IDE to know when to fold or unfold a comment. For example, one may tell the IDE to fold comments after two visits.

Conclusion

The goal of an IDE is to help developers. The IDE is especially useful for undertaking dull and easily automated tasks. It can do straightforward operations in the background while letting one focus on interesting things.

We have seen what already exists in the Eclipse IDE, while pointing out what developers can expect to see improved. In Part I, we saw the creation of comments issue and explained the Javadoc skeleton. In Part II, we showed how managing existing documentation within the source code becomes easier and faster. We analyzed the kind of improvements custom Javadoc tags can generate, among which reducing occurrences of the NullPointerException is outstanding. Even though IDEs are already doing a great job at helping developers write quality code, there is room for improvements. Because the Eclipse platform is extensible, one can use plug-ins to implement those improvements. However, one should not dream too much. In the current state of technology, developers will still have to write the informal content in the comments for quite some time.

It was our premise that good comments increase quality. However, code quality does not exclusively depend on static documentation; good design and tests contributes to code quality as well. Indeed, one should look on a large scale when evaluating tools. In an IDE, one should look at the supported aspects of one's methodology. With its extensibility, the Eclipse platform is especially well equipped for supporting custom methodologies within a coherent and seamless environment.

References

B. Le Charlier and P. Flener. Specifications are necessarily informal, or: Some more myths of formal methods. Journal of Systems and Software, Special Issue on Formal Methods Technology Transfer 40(3):275-296, March 1998. http://user.it.uu.se/~pierref/publications.html

Barbara Liskov and John Guttag. Program Development in Java: Abstraction, Specification, and OO Design. Addison-Wesley Pub Co 2000 ISBN: 0201657686

Barbara Liskov, "Data Abstraction and Hierarchy," SIGPLAN Notices, 23, 5 (May, 1988).

Resources

Source code for this article: Source.zip

Java Language Specification: http://java.sun.com/docs/books/jls/

Checkstyle: http://checkstyle.sourceforge.net/

CodeGuide: http://www.omnicore.com/index.htm

Borland JBuilder: http://www.borland.com/jbuilder/

Eclipse: http://www.eclipse.com

Net Beans: http://www.netbeans.org/

MS Visual Studio: http://msdn.microsoft.com/vstudio/

IntelliJ IDEA: http://www.jetbrains.com/idea/

Oracle JDeveloper: http://otn.oracle.com/products/jdev/index.html

About the Authors

Charles-Philip Bentley is a computer science engineering student at the Catholic University of Louvain (UCL). He is currently writing his dissertation titled "Research on tools for code specification and commenting." His main interests are OOP methodologies, user interface ergonomics, and software engineering techniques.
cbentley@student.info.ucl.ac.be

Baudouin Le Charlier is a professor at the Catholic University of Louvain (UCL). His research interest includes program analysis by abstract interpretation, program verification, intrusion detection, and interoperability of programming languages. He is teaching programming methodology, programming languages concepts, and formal syntax theory.
blc@info.ucl.ac.be





Page 4 of 4



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel