Take the 2-minute tour ×

Whether using the Repository pattern with an Interface or just implementing DataAccess methods in an application, I often see methods with either a 'Get' or 'Find' verb preceding the method description. I struggle a bit with differentiating between the (2), because I see conflicting examples when looking at DDD repository examples, or any other Architecture using a similar naming convention. For example take a look at the following:

Function FindAllEmployees() As List(Of Employee)

Function GetAllEmployees() As List(Of Employee)

Let's not look too closely at the subject of 'Employee', it is just an example; it could be anything. I am really interested if there are some guidelines on when to describe a method with a 'Get' vs. a 'Find' verb at the beginning.

Can anyone explain this or elaborate please? Thanks!

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

To me, FindAllEmployees indicates that it might accept a predicate with which to filter the results, whereas GetAllEmployees would do just that, return the complete list.

share|improve this answer
Just to clarify, my interpretation is that the results are references to the Employees. Saying "results" is just a tad vague. –  Adrian K Oct 11 '11 at 1:23
The 'predicate' would be a list of conditions applied at runtime to filter the results, or it would not be that dynamic? –  atconway Oct 11 '11 at 18:33
it could be a SQL style string, a Linq expression, some other way of specifying names and values. But yes, it would execute at runtime. –  Jason Miesionczek Oct 11 '11 at 18:40
add comment

Get throws an error if it doesn't exist (and usually only returns 1), Find returns null (or an empty IEnumerable).

Not sure if that's universal - but it's pretty clear to me. GetById, GetByName, etc. presume a match exists (and usually a single match). FindByEmail, FindByDepartment don't presume that, and usually return 0:n matches.

I may make an exception for a method like GetAll that takes no parameters and returns 1:n matches, but throws an exception on 0.

share|improve this answer
add comment

Your Answer


