Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Recommenders/CleanCodeMethodSorter"

m (Installation Instructions)
m (Description)
Line 5: Line 5:
 
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.  
 
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 [http://en.wikipedia.org/wiki/Robert_Cecil_Martin 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.  
+
Methods are reordered following the news-paper-metaphor conceived by [http://en.wikipedia.org/wiki/Robert_Cecil_Martin 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.
 +
 
 +
This plug-in is developed by Mateusz Parzonka and Fabian Richter as part of a University Hands-on and currently in testing phase. Your comments are greatly appreciated!
  
 
==== Installation Instructions  ====
 
==== Installation Instructions  ====

Revision as of 08:54, 20 August 2011

Plugin

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

Description

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.

This plug-in is developed by Mateusz Parzonka and Fabian Richter as part of a University Hands-on and currently in testing phase. Your comments are greatly appreciated!

Installation Instructions

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

Bugs

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

User-Interface

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.

SourceMenu.jpg

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.

PulldownMenu.jpg 

Preferences

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.