views:

119

answers:

4

I'm refactoring some client-server code and it uses the terms Response, Result & Reply for the same thing (an answer from the server). And although its not really that important it's become hard to guess which word to use while writing new code, so I'd like to unify the three terms into one and do the appropriate refactoring, but I'm not sure which word is the "best", if there is such a thing.

Any suggestions based on precedence and standards towards naming for this case?

+3  A: 

Response!

A server responds...
A person replies...
You get results...

sobedai
That sounds quite reasonable :)
Robert Gould
+1  A: 

Both response and result should be ok, because they can be shortened to "res".

Whereas reply would be "rep", which is ambiguous with repeat.

Maybe just follow the HTTP, call them request and response.

yuku
Yeah the calls were already Requests, so your right, Response definitely has some nice precedence there
Robert Gould
A: 

If you want to stick to standard ISO/OSI terminology, it's either "Indication" or "Confirmation". For an unconfirmed service, the initiator of the communication issues the "Request" (requesting that data be sent to the other side), which is delivered to the other side as an "Indication". For a confirmed service, the receiver of the Indication would reply with a "Response", which would include data to return to the initiating side. This data would be presented to the other side as a "Confirmation".

The data contained in the Confirmation indicates how the communication went (ie, we sent a query and got an answer). This can be called the result.

doppelfish
+1  A: 

Response. Result lacks the connotation of being an answer (we speak, for instance, of simple "function results"). Reply has the problem that it is both a noun and a verb. So Response is clearest.

Carl Manaster