public static FirstObjectType GetObject(SecondObjectType secondobjectType)
{
do something
}
Where should I put this function? Should I put it in SecondObjectType class or FirstObjectType class in terms of code readability, customs and traditions? Should the function be included in the return class or the parameter class from your experience?
Thanks for your answer.
I usually put the method in the class that has the same type as the return type of the method.
eg:
would go in the FirstObjectType class.
Alternatively you can use the Factory Pattern and have a factory for getting the objects you need. Which could give you code simliar to the following:
Then you always know which factory to get the object from based on its return type.