In recent years I found that keeping a well defined structure in my classes improved productivity. A well defined structure allows different people, adopting the same structure, to immediately understand where the various parts of the class are. Overtime I found what I think being a good structure, which follows:
{code}
public class Foo {
//------------------------> Static variables here
//------------------------> Instance variables here
//------------------------> Constructors here
//------------------------> Public business methods here
//------------------------> Getters/Setters here
//------------------------> toString, equals, hashCode methods here
//------------------------> Private methods here
//------------------------> Inner/Anonymous classes here
}
{code}
Such structure is easy to setup in Eclipse, for instance. Select Window -> Preferences -> Java -> Code Style -> Code Templates
Expand the "Code" tree and select "Class body", then "Edit" and just copy the code above.
Happy technology to everyone
M.
Recent Comments