Saturday 23 June 2012

Bracketeer : Bracket your Java Code in Eclipse

As an application developer, I regularly have to  understand and re-factor code that has been authored by other developers. It could be code coming from an open-source library or code from within the existing application. If it is Java code, it is sure to have one thing - Brackets and Braces. For simplicity, I am going to use the term 'Brackets' interchangeably for the rest of the article.
Since well commented and well-formatted code makes understanding the logic of the method or block easier, working out the start and end brackets within a block can take up a fair amount of time, especially  if the code has a high degree of cyclomatic  complexity. This scenario is when Bracketeer, which is currently featured as one of the top-most popular new Eclipse plugins is useful. While the plug-in is just six months old (as on June 2012) and is still in a beta-stage, I installed it in Eclipse Indigo SR1 and gave it a run.
While Bracketeer's ability to match brackets and color them is not exactly a new feature for Eclipse users, it's ability to introduce comments at the closing end of brackets is something that I found useful.
For example, the screenshot below show's an Eclipse editor without Bracketeer activated and the screenshot following it shows the comments that come up when Bracketeer's commenting feature is activated.
Bracketeer - Inactivated. No comments are visible
The screenshot below displays the result after activating, Bracketeer's commenting feature. It generates a comment that appears at the end of each closing bracket. This comment is similar to a pop-up and does not get added to the source file. Thus, resolving the start and end of braces becomes considerably simpler. {}
Source code with the Commenting Feature Enabled.

Finally, Bracketeer is customizable and can be configured to cater to your coloring and bracket matching requirements.Bracketeer can be installed as an Eclipse plug-in from here.
Customizable Interface for Bracketeer

No comments: