Coding Convention: Put identifying parameters first

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).

One thought on “Coding Convention: Put identifying parameters first

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s