When writing utility classes in Java, what are some good guidelines to follow?
Should packges be \"util\" or \"utils\"? Is it ClassUtil or ClassUtils? When is a class a
There is no standard rule/convention in Java world for this. However, I prefer adding "s" at the end of Class name as @colinD has mentioned.
That seems pretty standard to what Master java API Designer Josh Bloch does ( java collection as well as google collection)
As long as Helper and Util goes, I will call something a Helper when it has APIs that help to achieve a specific functionality of a package ( considering a package as to implement a module); mean while a Util may be called in any context.
For example in an application related to bank accounts, all number specific utility static APIs would go to org.mycompany.util.Numbers
All "Account" specific business rule helping APIs would go to
org.mycompany.account.AccountHelper
After all, it is a matter of providing better documentation and cleaner code.