This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 252645

Summary: Step-down Rule
Product: java Reporter: mau-ss
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description mau-ss 2015-05-28 11:38:15 UTC
It would be great if there would be a feature to organize the methods of a class, following the configuration specified by Editor->Formatting->Java->Code Generation, using the Step-down Rule and not the alphabetic order like today.

The Clean Code Method Sorter conceived by Robert C. Martin proposes to improve the readability of your source code following the newspaper metaphor:

A class should be readable like a newspaper, starting with the most important methods, followed by methods which are invoked later in the execution flow.
Comment 1 mau-ss 2015-06-05 11:43:03 UTC
I got a example from Greenkeeper's wiki:

Example sort by newspaper

Before sort:
<code>
void MethodD()
{ 
}

void MethodB()
{ 
}

void MethodA()
{
  MethodB()
  MethodC()
}

void MethodC()
{ 
   MethodD()
}
</code>

After sort by newspaper:

<code>
void MethodA()
{
  MethodB()
  MethodC()
}

void MethodB()
{ 
}

void MethodC()
{ 
   MethodD()
}

void MethodD()
{ 
}
</code>