Related to Standard Naming Convention for DAO Methods and DAO class methods naming questions.
Why the methods in DAO classes are like:
getUserById(int id)
getUserByUsernameAndPassword(String username, String password)
instead of:
getUser(int id)
getUser(String username, String password)
in IDE like Eclipse auto-suggest will start to show you both when you start to type getUser. And according to the parameters you can choose which method is to go with.
Of course this is overloading. Why people avoid overloading and use different method names for different parameters? Or are they avoiding?
Regards.
Your proposed naming scheme fails in 2 (obvious) ways.
First way, conflicting method signatures:
Second way, unclear code requiring you to verify parameter types and names:
Not to mention potential errors, when your variable isn't the type that you thought it was.