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"

(Restructured first chapter)
Line 1: Line 1:
== Plugin-Description ==
+
== 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.  
 
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.  
''Additional possibilities of method organization are planned for further builds:''
 
 
*''Clustering of getters and setters''
 
*''Clustering of overloaded methods''
 
 
== Installation Instructions  ==
 
  
 +
==== Installation Instructions  ====
 
You can download and install the plugin using the [http://vandyk.st.informatik.tu-darmstadt.de/updates/students/ep/mateusz-method-sorter/org.eclipselabs.recommenders.cleancode.methodsorter.repository/target/site/ update-site].  
 
You can download and install the plugin using the [http://vandyk.st.informatik.tu-darmstadt.de/updates/students/ep/mateusz-method-sorter/org.eclipselabs.recommenders.cleancode.methodsorter.repository/target/site/ update-site].  
  
Please report any encountered bugs [https://bugs.eclipse.org/bugs/show_bug.cgi?id=344394 here] (suggestions are also welcome).  
+
==== Bugs and Issues ====
 +
So far, no issues and bugs documented. Please report any encountered bugs [https://bugs.eclipse.org/bugs/show_bug.cgi?id=344394 here] (suggestions are also welcome).  
  
'''Currently BETA-stadium: Features and description are subject to change. No issues reported, (but) use it at your own risk.'''
+
==== Planned Features ====
 +
*Clustering of getters and setters
 +
*Clustering of overloaded methods
  
 
== User-Interface  ==
 
== User-Interface  ==
Line 27: Line 27:
 
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.  
 
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.  
  
[[Image:SourceMenu.jpg]]
+
[[Image:SourceMenu.jpg]]  
  
 
=== Processing of multiple Java-classes  ===
 
=== Processing of multiple Java-classes  ===
Line 35: Line 35:
 
"Sort methods…" can be called on any selection of  
 
"Sort methods…" can be called on any selection of  
  
*<strike></strike>Java-projects  
+
*Java-projects  
 
*source folders  
 
*source folders  
 
*packages  
 
*packages  
Line 44: Line 44:
 
''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.''  
 
''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.''  
  
<br> [[Image:PulldownMenu.jpg]]
+
[[Image:PulldownMenu.jpg]]  
  
 
== Preferences  ==
 
== Preferences  ==

Revision as of 12:30, 19 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.

Installation Instructions

You can download and install the plugin using the update-site.

Bugs and Issues

So far, no issues and bugs 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.

Back to the top