I would say that my reason for avoiding this would be because it is easiest to get the process data from the process and return one logical part of the data. If he needs to return more data, he may be a candidate for further abstraction or formalization of the return value.
The only exception is if the returned data is somewhat tertiary, for example, nullool bool. It can be true / false or undefined. The out parameter can help solve a similar idea for other boolean types.
Another that I sometimes use is when you need to get information through an interface that does not allow you to use the "best" method. For example, using the .Net and ORM access libraries. When you need to return an updated graphic object (after UPDATE) or a new generated RDBMS identifier (INSERT), as well as the number of lines affected by the instruction. SQL returns all this in a single expression, so several method calls will not work, since your data level, library or ORM calls only one common INSERT / UPDATE command and cannot store values for subsequent searches.
Ideal methods, such as never using dynamic parameter lists or parameters, are not always practical all the time. Again, think twice if the out parameter is really the right way to do this. If yes, then go. (But make sure it's good!)
Jon Adams Sep 26 '08 at 3:15 2008-09-26 03:15
source share