Skip to main content
Jump to: navigation, search

Difference between revisions of "Recommenders/CleanCodeMethodSorter"

(Bugs and Issues)
m (Installation Instructions)
Line 8: Line 8:
==== Installation Instructions  ====
==== Installation Instructions  ====
You can download and install the plugin using the [ update-site].  
Please download and install the plugin using the [ update-site].
==== Bugs ====
==== Bugs ====

Revision as of 12:31, 19 August 2011


Currently BETA-stadium (Build 100, 08/19/2011). Features and description are subject to change.


The Clean Code Method Sorter is a plugin for the Eclipse Platform. It provides techniques to sort methods in Java-classes, aiming to increase the readability of the source code.

Methods are reordered following the news-paper-metaphor conceived by Robert C. Martin in his book "Clean Code": A class should be readable like a newspaper, with the most important methods being at the beginning of the class, followed by methods which are invoked later in the execution flow.

Installation Instructions

Please download and install the plugin using the update-site.


So far, no issues documented. Please report any encountered bugs here (suggestions are also welcome).

Planned Features

  • Clustering of getters and setters
  • Clustering of overloaded methods


The plugin mainly provides a "Sort Methods"-Operation which can be triggered from different Points.

Processing of individual Java-classes

When a Java-class is opened in the Java Editor, the source menu should be visible in the main menu bar. The plugin augments the import-group in the source menu with a command labeled "Sort methods…". Triggering this command lets the Clean Code Method Sorter sort the methods in this class.

Per default, the command is bound to the keybinding "Option-S" (Mac) or "alt-S" (other platforms). User-defined keybindings are possible: Search for the command "Sort methods…" in the "Clean Code"-category in the keys-preferences-menu.


Processing of multiple Java-classes

When selecting Java-specific content in the Package Explorer a right mouse-click (context-click) activates the associated pop-up-menu. In the Java-context, a source-submenu is visible. The plugin augments the import-group in this menu with the command labeled "Sort methods…", which will sort all methods in selected objects and their child-objects upon triggering.

"Sort methods…" can be called on any selection of

  • Java-projects
  • source folders
  • packages
  • compilation units (Java-files).

After successful sorting, a message will appear showing the number of processed classes.

In the beta-phase an additional command "Shuffle methods randomly…" may be available which shuffles methods randomly to enable easier evaluation of the method sorter.



This section will be expanded in the following builds.

Currenty, following preferences are provided:

Invocation ordering strategy in method bodies
  • Breadth-first: Ordering is following a breadth-first-search approach in the invocation graph.
  • Depth-first: Ordering is following a depth-first-search approach in the invocation graph.
Priorize access levels

When activated, methods are clustered according to their access level before being sorted by invocation order.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.