Search code examples
javanaming-conventionsnaming

is "get" the right prefix for a service's method that queries a DB?


I'm writing a method that given a product, returns for each country the number of sales. I named it getNumOfSalesByCountry().

To me, the word "get" relates to a getter of a bean and not to a function that makes a query to a DB.

Can you suggest better names? (Or you think the name is valid)

Thanks


Solution

  • You can name it something like retrieveNumOfSalesByCountry(), but I think getNumOfSalesByCountry() is good too.