[TYPO3-50-general] Helping Functions

Robert Lemke robert at typo3.org
Mon Feb 2 15:18:09 CET 2009


Hi Nino,

Am 02.02.2009 um 14:44 schrieb Nino Martincevic:

>>> Why you have a getter if you set it private?
>>> Or why you set it private when you provide a getter?
>>
>> Because you don't want people to access the variable directly.
>
> But what does this getter do?

It allows you to change your mind and change your code so that
it processes the value at a later time. If you use public properties
in an API, you completely give up control.

IMO, it is generally a bad idea to expose mutable objects / values.

Cheers,
robert


More information about the TYPO3-project-5_0-general mailing list