views:

202

answers:

6

I'm writing a desktop application that communicates with a web service. Would you name all web-service functions that that fetch data LoadXXXX, since they take a while to execute. Or would you use GetXXXX, for instance when getting just a single object.

+3  A: 

Get. And then provide a way of calling them asynchronously to emphasize that they may be out to lunch for a while...

Shog9
+4  A: 

I would use Load if you expect it to take "file-time" and Get if you expect it to take "simple DB" time.

That is, if the call is expensive, use "Load".

Michael Haren
Just to clarify--if you have a long query from a DB--I'd use Load there, too.
Michael Haren
+1  A: 

Always use Get, except perhaps when actually loading something (eg, loading a file into memory).

Thomas Owens
A: 

When I read LoadXXX, I'm already thinking that the data comes from some storage media. Since the web service is up in the cloud, GetXXX feels more natural.

radu_c
+8  A: 

Use MyObject.GetXXXX() when the method returns XXXX.

Use MyObject.LoadXXXX() when XXXX will be loaded into MyObject, in other words, when MyObject keeps control of XXXX.

The same applies to webservices, I guess.

Jorge Alves
+1  A: 

Do what the verb implies. GetXXX implies that something is being returned to the caller, while LoadXXX doesn't necessarily return something as it may be just loading something into memory.

For an API, use GetXXX to be clear to the caller that something will be returned.

jpeacock