Tuesday Oct 08, 2013

Towards a Centralized Dashboard for Coding Problems

When you're switching from one IDE to another, you'll sometimes find that similar features have been implemented differently. So too the Eclipse Problems View, which has its NetBeans equivalent in the NetBeans Action Items Window. Kind of nice that what is seen as a "problem" in Eclipse is, more positively, seen as an "action item" in NetBeans. :-)

Go to Window | Action Items or press Ctrl-6 to see the above window.

However, a problem with the NetBeans Action Items Window (or, maybe, an action item for the Action Items Window) is the fact that it doesn't show hints, only compiler errors and TODOs, together with various other items, such as Hudson, Maven, and EasyPMD messages. But, on the level of Java code messaging, the Java hints (e.g., "Unused import statement"), i.e., these are not compiler errors but are problematic nonetheless, are not shown in the Action Items Window. That's, in fact, also the case in IntelliJ IDEA, where TODO messages, compiler errors, and inspections are all found in separate windows. This approach makes sense because these various kinds of messages behave differently and are used at different times during development. For example, inspection results offer configuration possibilities, you can exclude items from the report, and group items by category. Inspection results are handy for pinpointing areas that require code reviews. On the other hand, "action items", e.g., "TODO" messages, are items provided by the user, which means the IDE has no logic to process them, except by letting you group them and letting you filter them based on patterns. A compiler error is completely different, requiring immediate attention.

For that reason, since they have the same user experience in IntelliJ IDEA, people switching from IntelliJ IDEA to NetBeans never complain about missing items in the Action Items Window. However, Eclipse users, when switching to NetBeans, tend to (1) not find the Action Items Window (see this blog entry by Adam Bien from 2007 [showing that this was even the first item on the list] at which point the Action Items Window was the Task List Window) and (2) miss, in the NetBeans Action Items Window, the range of messages that the Eclipse Problems View provides (see this Tweet by Marcus Lagergren).

There's also an issue for this:


In the case of NetBeans IDE, the Java hints are displayed, as explained above, in a separate window. Specifically, in the Inspector Window or the Refactoring Window.

This window is displayed after you invoke Source | Inspect (shows the Inspector Window) or Refactor | Inspect & Transform (shows the Refactoring Window). In the latter case, you have the option of batch refactoring everything that the Java hints have found for you, e.g., let the IDE remove all unused import statements for you.

Aside from the above differences in philosophy about the usefulness of combining all messages within a single window, there's also concerns about performance. One should indeed be very cautious about messages that refresh automatically, which is why the Inspector Window and the Refactoring Window require a manual refresh. Manual refreshes generally do not have strict requirements on performance, while automatic refreshes require the results to be correct, to be computed quickly, and to be done unobtrusively.

Nevertheless, having said all of the above, and specifically for Eclipse users new to the NetBeans world, here you can see the Java hints displayed in the Action Items Window. Click to enlarge the image to get a better view.

The plugin that provides the above functionality (by Jan Lahoda) can be downloaded here from the Plugin Portal. The plugin provides all Java hints (whether they are enabled or not), but not the FindBugs hints, in the Action Items Window. One can double-click from the hint into the line where the problem occurs. When the problem is fixed, one needs to refresh the Action Items Window, i.e., the refresh is not done automatically. (Note that the plugin hasn't been heavily tested, so please consider it experimental at this stage. It has been created for 7.4 RC 1.)

In other words, the plugin meets the Eclipse user halfway. It lets you see in one centralized window everything that is actionable in the current file, current project, or in all projects. But, unlike the compiler errors and TODO messages, the Action Items Window does not automatically refresh itself when a problem has been solved. However, kind of unrelated to this topic, but interesting to be aware of, is that when solving one instance of a problem, simply by clicking the right arrow key, you can solve that same problem for all other instances throughout your code:

Interested to hear opinions on the above, especially from refugees from Eclipse land!


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« October 2013 »