[Typo3-dev] Alternative to hooks - fake "$this"

Frank Benkart [DIACC] frank.benkart at diacc.de
Fri Oct 29 16:08:41 CEST 2004


Hi Martin,
ok you don't understand that joke with the F1 car.

Ok one step with could do very easy and very fast to get more reusable code
from the core is one more abstraction of this coding idea in allmost all
core classes.

The following code exampel shows the cureent architecture:

myFile.php

<?
  class  myClass {
    function init(){
      //some code
    }

    function main(){
      //some code
    }

    function printContent(){
    return 'HTML code';
    }

    function doSomthing(){
      return 'Hello world';
    }
  }

  $SOBE = t3lib_div::makeInstance('myClass');
  $SOBE->init();

  $SOBE->main();
  $SOBE->printContent();
?>

This code architecture is the standard core archtecture. This is not very
hopeful reusing core functionality, for example a tree or a tree for page
positioning. I have allready needed this classes funtion in my own
extensions!

I think first way of new architecture without loosinf any compatibility is
only a little abstraction like this:

myClass.php

<?
   class  myClass {
    function init(){
      //some code
    }

    function main(){
      //some code
    }

    function printContent(){
    return 'HTML code';
    }

    function doSomthing(){
      return 'Hello world';
    }
  }
?>

myFile.php

<?
  include_once('myClass.php');

  $SOBE = t3lib_div::makeInstance('myClass');
  $SOBE->init();

  $SOBE->main();
  $SOBE->printContent();
?>


Do you see the differences? And what do you think about this?

-----------------------------------------------------------
live strong - live typo3

"Martin T. Kutschker" <Martin.no5pam.Kutschker at blackbox.n0spam.net> schrieb
im Newsbeitrag
news:mailman.1.1099050355.14608.typo3-dev at lists.netfielders.de...
> Frank Benkart [DIACC] wrote:
>
> > Hi Martin,
> > i understand your thinking. But i don't understand why normilisation
should
> > be so important.
>
> I'm nor arguing for or against it. I'm trying to get those peaople who
> like to see changes to formulate their ideas and list their goals.
>
> > Think that. You will build a Formular 1 car. you don't beginn with the
> > chassis and the aerodynamic. you start with the engine.
>
> Really? I'm not into F1, but I guess you can put any engine inside a
> well designed car.
>
> > We do things with typo3 were we need very very often core classes an
core
> > features in our extensions. so we need a oop architecture and not that
> > pseudo oop.
>
> Of course I'd like to see more OO-ideals in TYPO3. But I want to see
> plans on how this is going to happen and infos on where it will get us.
>
> Masi






More information about the TYPO3-dev mailing list