Re: Encapsulation vs "introduce parameter object"



Flo <sensorflo@xxxxxxxxx> wrote:

Not a contradiction. Read the next paragraph in _Refactoring_. "...once
you have clumped together the parameters, you soon see behavior that you
can also move into the new class."

In other words, you will end up re-encapsulating the data.

I thought that only refers to operations operation directly on the
data members of the new parameter object. E.g. in the simples case
getters & setters, maybe methods ensuring invariants. But not such a
complex operation like MeasureTouchDown.

Certainly the portions of the operation that involve the data it
contains, yes.

Apparently CMyModule *doesn't* have all the information necessary to do
the touch down measurement or you wouldn't have to pass the clump of
data to it. What would happen if you moved all the data into the
CMyModule directly?

I think I can not do that because depending on the actual environment
there are different touch down parameters. Maybe I have to add that
there is not only one ground, but different grounds depending on the x
y position of the module.

Is any one particular CMyModule object used in two or more different
environments during its lifetime?
.