When declaring a FactoryMethod, put identifying parameters first.
For example, instead of this:
public Contact createContact(Country countryToBeCovered, String contactName);
do this:
public Contract createContact(String contactName, Country countryToBeCovered);
This is mostly for test code, where you may well be creating several different instances of the same object as part of a test fixture. Placing identifying parameters first helps to distinguish them visually a lot better than if they are at the end (or, worse, buried somewhere in the middle).
Comments (1)
Hm... makes perfect sense! Why not submit it to Martin Fowler as a new refactoring? Sure, it is trivial, but so are the tqo refactorings I've sent to him!
http://www.refactoring.com
Posted by Mats Henricson | March 12, 2005 2:39 AM
Posted on March 12, 2005 02:39