Passing single object vs. passing multiple parameters
问题 Suppose I have the following Class A { Foo getFoo(); Bar getBar(); Baz getBaz(); } And I need to define a function doStuff that uses Foo , Bar , Baz of one object and does some stuff I'm struggling between which method of implementing doStuff is better (suppose it would be undesirable to place doStuff inside class A ) Method A void doStuff(Foo foo, Bar bar, Baz baz) { //some operation } or Method B void doStuff(A a) { Foo foo = a.getFoo(); Bar bar = a.getBar(); Baz baz = a.getBaz(); //some