الاثنين، 17 مارس 2008

Improving code browsing in Eclipse [Update]

Related posts: "Online Eclipse E4? Lack of imagination!", "Eclipse 4 wishes: simplification first, then innovation".

Again, I want to prevent ideas of mine from getting lost, so I'm publishing my comments to an Eclipse bug report as a blog entry.

Faceted browsing for Java code

I'd love to have a universal code browsing solution that uses "facets" (tags with values). An example of well-done facet navigation is iTunes where you have facets for songs such as composer and title. If you look closely, there is quite a bit of information attached to a method that could be considered tags/facets: Visibility, static vs. non-static, annotations etc. JavaDoc's @category just adds one more dimension here. With a facet browser, one could formulate queries such as the following in a very natural way: "Give me all public methods with annotation @Remote that belong to category 'persistence'". This browser should optionally access all methods (of all classes) in order to serve as a universal query mechanism.

Improving the outline: nested methods, method groups

We have written a research prototype that improves just the outline view in two ways:
  • Nested methods: If a method n is private and only used by a method m, then file n under m in the hierarchy (thus, n is not visible at the top level, any more). The reasoning here is: "extract method" is a great refactoring for cleaning up code, but it unnecessarily clutters the top level of the code outline.
  • Method groups (this can be replaced by @category!): If a sequence of methods is preceded by a commentary //--------- foo then these methods will be filed under a node "foo" in the hierarchy (= one additional level of nesting)
For method groups, one can also view categories as tags and, instead of introducing another level of nesting, list the categories as toggle-able buttons that filter the outline:

+-----------------------+
| o | x | @ | # | * | + | <-- icons
+-----------------------+
| (read) (write) (sort) | <-- buttons
| (init) |
| |
| - prepareForSorting() | <-- outline tree
| - writeContents() |
| ... |
+-----------------------+

Thus: Selecting a button filters the outline, unselecting it undoes the filtering. Another possibility is to have filter buttons for "private", "public", "static" etc, too.

This might also be complementary to the nesting approach.

Update: At EclipseCon 2008, there is now talk about "E4", the next generation of Eclipse. There is a lot of talk about expanding the platform (ReSTful web services etc.). Voices to simplify are there, as well; let's hope that they will not be ignored:

ليست هناك تعليقات:

إرسال تعليق