Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Two part question:

  1. I am working on a project where the webservices all return a generic object. On success, that object then contains the data returned from the webservice along with additional information such as status messages or qualifiers. On failure, the object contains no data and error messages. What is the name for this pattern?
  2. When I think that something I am working on is a common pattern and has a name, what strategies can I use to learn what that name is? I frequently see things that look familiar or common and suspect they have a name and are a common pattern. How can I find those on my own without asking StackExchange?
share|improve this question
    
Typically, you really want the error codes, messages and other information on failure. And could care less on success. I'm just sayin' –  Wyatt Barnett Oct 3 '11 at 17:54
    
I am aware that this return type is not the best. There was a lengthy discussion about this, but the powers that be say it must be this way. My goals at this time are to document and describe this behavior as correctly and as accurately as possible. –  Freiheit Oct 3 '11 at 18:10
    
indecision? /me ducks –  oɔɯǝɹ Nov 2 '11 at 22:21
add comment

1 Answer

up vote 1 down vote accepted
  1. [...] What is the name for this pattern?

None. Returning value that have meaning for the rest of the code is what every function returning value does, in any language.

2, First, read the Design Patterns book to get the names commonly used. Most of the time any recurring solution you've seen will be an implementation of one or a combination of several of those patterns. After that, if you can't find what name should be used for a pattern, find an analogy to name it yourself. Use it until you discover the name commonly used, if it exists.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.