Naming is pretty subjective, but in my opinion there's 2 things to follow to have "good names".
- Be precise.
- Follow the principle of least
astonishment.
These two principles are important for maintenance; if you have a bunch of methods named GetData
, people won't know what to expect and will waste time reading the doc to find the appropriate overload.
You also want to have names representing the level of abstraction you're at. So let's say you want to get some entities named Page
. At the DAO level it could easily be public DataTable GetPagesTable();
, because you're dealing with tables. At a higher level of abstraction, with the List, you could change it to public List GetPages();
(Removed Table from the name). You're far from the database, so the names should reflect that.
If you're passing an object or ID, say it clearly in the method name to avoid any surprises, like public DataTable GetPagesFromId(int id);
From your examples, I would probably end up with something like that :
public DataTable Get<TableName>Table() - returns the data from a given table
public List Get<ObjectName>s() - returns the data in the form of List of objects
public DataSet Get<ComposedObjectName>() - returns the data when there are multiple data tables associated with queries
public objectx Get<ObjectName>(objecty) - returns selected object
public DataSet Get<ObjectName>AsMasterChild(objecty) - returns selected object (ex: in case of master-child)