lundi 17 avril 2017

Software practices - Is it okay to make a method polymorphic using an output argument

We had a use case where a specific request object say A must be converted to a class of type B or type C. For that we wrote static methods mapToB(A) and mapToC(A). But wouldn't it be better to have a polymorphic map method of type map(A, B) and map(A, C). I know that output arguments are considered an anti-pattern, but the 2nd implementation looks cleaner.

Aucun commentaire:

Enregistrer un commentaire