[TYPO3-50-general] Magic Get too magic?

Elmar HInz elmar.hinz at team.MINUS.red.DOT.net
Fri Feb 23 09:38:26 CET 2007

>    TYPO3::getInstance()->getComponentManager()->...
>    TYPO3::getInstance()->componentManager->...


in Java I have learned never to access object variables directly, but
always to access them by getters/setters.  

I like this:

A.) Plain setters/getters that don't manipulate values:

 They are named get/set.

 1.) Generics:

   $this->set('someVariableName', 'someValue');

 2.) Named setters/getters:


B.) Setters/getters that perform some action like instantiation, loading,
    transformations etc.:

  They are named but by their performing action, to document what they do.

  $Class = Factory::findService('SomeService');
  $T3 = TYPO3::findIt() ...   or  $T3 = TYPO3::makeIt() ...
  $variable = $this->loadSomeVariableName();



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