[TYPO3-ect] MVC and image rendering...
R. van Twisk
typo3 at rvt.dds.nl
Sun Mar 4 14:36:11 CET 2007
Elmar HInz wrote:
>> By doing it that way image rendering get's extremely simple
>> and I have full GIFBUILDER options available. Using tx_lib_image
>> I have to copy values from TS config and call functions to tx_lib_image
>> which will take up to much of my precious resources, and takes
>> all my flexibility away.
>>
>
> Objects need more resources. But in TYPO3 the mayor question of
> performance is to do caching right or wrong. The question of objects or
> arrays is comparingly tiny. If your problem is performance of
> totally dynamic applications TYPO3 4.x may be the wrong tool. It is not
> optimized for that, because caching happens on the page level. Maybe 5.x
> will bring improvements for this.
>
I do agree on that, however I am trying to get my page generation time
as low
as possible anyways.
I also agree that the overhead for doing it in object is indeed low.
>
>> Currently it feels like that tx_lib_object and phpview are a married couple.
>>
>
> tx_lib_object is the granfather of all and everything. Unlikely he marries
> his grandchild. :-)
>
>
>> and that tx_lib_object and smarty are like water and fire....
>>
>
> I would not subscribe that.
>
>
>
>
>> May be it's the whole SPL thing I don't like, I am not sure yet but it
>> looks
>> like a wrapper around PHP's variables. Properly it's just me, but
>>
>
> Object orientated programming is defined as making a wrapper around data
> and adding functions related to that data. If you don't like it you have
> problems with OOP in general. If you come from a PHP/TYPO3 background that
> would be typical because neither PHP nor TYPO3 are designed OO. TYPO3 in
> general uses objects as simple function containers but doesn't make use of
> real OO features.
>
Agreed with teh above.
I have done OO programming in C++ quite a bit, mostly in MFC and Qt.
Normally views have a parent that is something like base_view, and
controllers
have something like controller_base and models do have model_bases.
Each object type has a different task, but only the model would store
data, NOT
the view or controller.
The controller would init the model and the model get's filled with data.
Then the controller simply passed the complete model to the view.
views don't store data, they just hold the model.
In MVC (and I only know this implementation)
they all have a base in tx_lib_object which I don't find OOish correct.
I have never seen a OO design where different objects types share the
same base like this.
(may be just some base_object with some general functions, but that's it...)
> We need time to learn and discover the advantages of new technics. In
> history the farmers didn't see the advantage to send their children to
> schools ...
>
> (OT: And they where right ... children learned to construct aeroplains
> ... now we die by aeroplain air pollution and we are killed by people that
> travel round the world more than once in 5 years. 33% percent of climate
> effect of the traffic is caused by aeroplanes and the rate is fastly
> growing. Only a few percent of humans profit by it, but all humans
> and plants and animals suffer. A small minority amuses itself on the costs
> of the rest. Sell airplain holidays or sell weapons. What is the
> difference? Weapons don't kill that sustainable. What is a war comparing
> the foundation of an aeroplane line?)
>
You completely lost me here.... Are you sure we talk about lib/div here?? :)
>
>> currently I
>> see it as a resource hook...
>>
>>
>> What I normally do is get a dataset from a DB and store it in a
>> associate array.
>> Then I pass that dataset directly to smarty (often as a reference) and I let
>> smarty render the whole thing.
>>
>>
>
> Somthing in this direction will do the trick:
>
> $smarty->setData($model->getArrayCopy());
>
> I don't know the API of smarty.
>
I tested getArrayCopy and it works brilliantly!!
I was looking for it, but wasn't sure if I got a copy
back of some object, or the 'raw' data.
>
> Regards
>
> Elmar
>
>
>
--
Ries van Twisk
Freelance Typo3 Developer
=== Private:
email: ries at vantwisk.nl
web: http://www.rvantwisk.nl/freelance-typo3.html
skype: callto://r.vantwisk
More information about the TYPO3-team-extension-coordination
mailing list