General Method Best Practices

               Parag Shah

     http://www.diycomputerscience.com
Follow Java coding conventions
The method name should be clear
Avoid using names of datatypes in methods

         Eg: getAccountsArrayList()
Names should be consistent

 Eg: Either delete() or remove()
Do not go overboard in providing convenience
                 methods
Avoid long parameter lists
For parameter types, favor interfaces over classes
Use overloading judiciously
Do not invoke non final public or protected methods from
           the constructor of a non final class
Avoid returning null as far as possible.

  Throw Exception to signify a problem

   Return an empty list instead of null
A little something before leaving

     5 == x instead of x == 5

       “someStr”.equals(x)
           instead of
       x.equals(“someStr”)

General method best_practices