Browsing Eclipse Java Perspectives
When developing in Eclipse I favour the Java Browsing perspective over the Java Perspective. Here’s why …
The Java Browsing Perspective organises the IDE views with the Projects, Packages, Types and Members views laid out horizontally at the top of the IDE window, and the editor area underneath.
This arrangement will be familiar to those that have developed in Smalltalk or Visual Age for Java. It pops up in other places such as the Ruby documentation at RDoc.
The Java Browsing Perspective continues this tradition. Here is an example:
Compare this to the Java Perspective:
So why do I like it? There are at least two areas where this perspective has an advantage of the Java Perspective or other IDEs that use a similar approach: navigation and code design.
The browsing perspective presents information much more compactly than the Java perspective making navigation of the codebase much easier. Even for the small project1 shown in the screenshots above, the Java perspective cannot show all the packages, source folders or method names (outline view). But the entire project is visible in the browsing perspective.
But some people do not like this perspective because the amount of editing space is less than other perspectives – “you cannot see the whole file you are currently editing”. I become concerned when I hear talk of files and the need to see as much of a class as possible.
For object oriented programming, thoughts should be on types and their interfaces, not implementation details and certainly not files. Having to know how methods are implemented to use them should be something we strive to avoid. Codebases I have worked on that require careful study of implementation details to use or extend a type have always been a bit of a mess.
To help you focus on types and interfaces there is one more magic button you can press: Show Source of Selected Element Only2. Enabling this feature limits the editor to the source of methods you select in the Members view, or the whole class if you select it in the Types view. This creates even more space for other views you might need, but more importantly, you will find yourself looking more to the types and member views (behaviours!), rather than implementation details in the editor. This is what it looks like:
There is one more tweak I make to this perspective, I put the Members view on the right using all the vertical space:
I have found this arrangement helps me navigate the codebase quickly, especially when using small monitors like a laptop screen.
It might take you some time to get used to this perspective. When I switched from Visual Cafe to Visual Age for Java in the late nineties I struggled a bit at first. But after a short while I found it to be much more efficient.
Try it for a week, what’s the worst that could happen?
1 This project is called JEDI, soon to be released. If you like functional languages, you’ll find JEDI offers a little relief in a world of Java.
2 You may need to add the Show Source of Selected Element Only buttons to the perspective as follows. From the Window menu select Customise Perspective. Click on the Commands tab and select Editor Presentation.