[Typo3-dev] singletons instead of pre-loaded objects

Leendert Brouwer [Netcreators] leendert at netcreators.nl
Wed Aug 11 09:48:56 CEST 2004


Hi Kasper,

> > There is something real to gain. The advantages OO (and related
concepts)
> > has to offer :) Especially in a highly extendable system such as TYPO3,
a
> > proper design and seamless communication is essential, imho.
>
> In reality it hasn't shown to be essential. Or will you claim that
> TYPO3s success is a coincidence despite a bad design?

I wouldn't call it a coincidence. It has a design, maybe even a good design
depending on how you see it, it's just not a proper OO design. And many
developers are already familiar with OO design so if it had a proper OO
design, it'd probably be easier to pick it up. I remember staring at the
code being puzzled quite often for the first few months after I was hired to
merely write extensions for it (I never worked with TYPO3 before that). I
didn't find it intuitive because I have an OO background, that's all. And I
think there are many out there who think like me, that's why I said it's
essential. Essential for developers to understand and extend the system.


> Sorry, I have never been schooled as a programmer and its too late now.
> TYPO3 is "take it or leave it - or influence it with your own
> extensions". I will continue my programming as I always did.

Sure. It's not like I'm trying to whine about it. Just pointing out a few
things, it is by no means an attack.

>
> BUT... I do believe that with proper OO design you would *not* have had
> an application like TYPO3 as fast as it has been made. OO also is a lot
> of programming overhead (takes more time to write)!!

That is not necessarily true. There are many techniques in OO that speed
things up. Sure, sometimes the procedural way has less overhead, but
patterns such as lazy load, singleton and so on can cause huge performance
gains. As for the 'how long would it take to write X' argument, I can't
agree with you. It may seem that in true OO things get developed very
slowly, but in the long run, it has often proved that it can well be the
most efficient way (heavyweights like Thoughtworks do use OO for a reason).
Sure it takes some experience and design consideration sometimes, but it is
absolutely not per definition slower than procedural development.

> Personally I don't
> find OO code easier to understand either. I can do procedural
> programming 3 times faster.

I suppose that's a personal matter. Being able to think in objects takes
time.

> Execution overhead is probably significant
> as well. And if newer PHP versions solves that, you cannot use that
> argument against TYPO3 which has been developed over 5 years in the
> past.

Well techniques such as pass-by-reference could speed up things in the past
significantly (as significant as making it about as fast as in PHP5), so it
never really stopped me for performance reasons.

>
> And I'm not sure you are right about the overriding functionality bit.
> It just works a little different as it is now, but you can still do it.
> And the Extension API shows that it actually works pretty well.

The extension API is fine. Overriding 440 line methods to change 3 lines of
behavour is not as pleasant.

> Honestly! The design of TYPO3 *HAS* time and again shown that
> opportunities are there despite not being OO design! Otherwise it
> wouldn't have been a top-10 OSS CMS (according to Gartner Group
> Analysis)

Sure, but I'm talking only about 'under the hood' things. My interest lies
in technology, not in statistics.

> I think the reality is that you should accept that TYPO3 is what it is
> and if that is not good enough, start a new CMS from scratch instead (or
> use another existing).
>
> And eventually "There is something real to gain." - you didn't show
> convincingly what that was.

I didn't convince you, maybe. But then, you're not into OO much, as you
said, so maybe that's the reason why I can't convince you.

>
> Question; If the design of TYPO3 is a problem for the future, why are
> you using TYPO3 and not another CMS which is better designed in your
> opinion?

Part of the job, I didn't choose to use it. I'm OO minded and I've worked
with many applications of which I thought the design could have been
improved significantly. In these cases, I try to give constructive
criticism. Again, I am by no means trying to attack anyone. I'm just
pointing out what I'm running into from an OO perspective.

Kind regards,
Leendert






More information about the TYPO3-dev mailing list