I know there are some questions about "Introduce parameter object", eg: Is "Introduce Parameter Object" actually a good pattern?, Should we avoid custom objects as parameters?, which means this form:
public void myMethod(int parameter1,int parameter2){
}
should be refactored as:
public class ObjectForMyMethod{
public int parameter1;
public int parameter2;
}
public void myMethod(ObjectForMyMethod objectForMyMethod){
}
which has some advantages, such as adding parameters without changing method signatures , and reduce the chance of passing list of data with same types in wrong order. However, in my experience, "Introduce parameter objects" are rare to see (ie: keep list of parameters instead of passing a single object).
Are all methods with more than one parameter instead of introducing parameter objects bad? Why don't we always "Introduce parameter objects"? Is "avoid introduce parameter objects" just a result of "lazy creating a new class"? If not, what is the good reasons to keep multiple parameters instead of introducing parameter objects?