Miscellaneous questions...

Emilio Oca eoca at afip.gov.ar
Fri Sep 9 12:56:15 UTC 2005



> -----Mensaje original-----
> De: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org]En nombre de Alan
> Lovejoy
> Enviado el: Viernes, 09 de Septiembre de 2005 02:03
> Para: 'The general-purpose Squeak developers list'
> Asunto: RE: Miscellaneous questions...
>
>
>
> An accessor method must be justified by one of two requirements: 1) The
> value of the instance variable needs to be provided as a part of the
> object's API, or 2) the value must be lazily initialized or recomputed.
> Otherwise, an accessor is not only unnecessary, it violates the
> information
> hiding principle.
>
> A mutator method must be justified by one of two requirements: 1)
> The value
> of the instance variable must be settable as part of the object's public
> API, or 2) there is an invariant that must be maintained whenever
> the value
> of the instance variable is changed (e.g., a change event must be
> propagated, the value of another instance variable must be
> recomputed, etc.)
> Otherwise, a mutator is not only unnecessary, it violates encapuslation.

Hum, no at all, you forgot may be rule No 3, you may wish no to be bound to
the internal struture of your object within your very object itself. May be
because your are not sure of the internal shape your object would have.
Any way, is valid, it's called double encapsulation.

saludos

	Emilio







More information about the Squeak-dev mailing list