When is a Java method name too long? [closed]
Some techniques for reducing the length of method names:
If your whole program, or class, or module is about 'skin care items' you can drop skin care. For example, if your class is called
SkinCareUtils
,that brings you togetNumberOfEligibleItemsWithinTransaction
You can change within to in,
getNumberOfEligibleItemsInTransaction
You can change Transaction to Tx, which gets you to
getNumberOfEligibleItemsInTx
.Or if the method accepts a param of type
Transaction
you can drop the InTx altogether:getNumberOfEligibleItems
You change numberOf by count:
getEligibleItemsCount
Now that is very reasonable. And it is 60% shorter.