|
Posted by mypetprogrammer on 06/03/07 07:59
On Jun 2, 11:14 pm, howa <howac...@gmail.com> wrote:
> On 6 3 , 6 42 , gosha bine <stereof...@gmail.com> wrote:
>
>
>
> > howa wrote:
> > $foo = new Foo
>
> > does the following in php4:
>
> > 1) a chunk of memory is allocated and object's constructor is called to
> > initialize this memory
> > 2) another chunk of memory is allocated and everything from the first
> > chunk is copied to it
> > 3) variable 'foo' is being set to address of this second chunk
> > 4) the first chunk is being disposed.
>
> > Apart from being ineffective, this technique will apparently fail if an
> > object saves reference to itself ($this) in constructor or when you need
> > exactly one instance.
>
> Hello,
>
> Yes, but refer to my original question, both (1) & (2) have this
> problem of inefficieny.
>
> So you said (2) is perfferred?
>
> Why? Since PHP said return by reference is mostly useless.
>
> > I agree that OO "features" of php5 are mostly useless and php4 has
> > everything one needs to write OO programs. However, I still won't
> > recommend it, exactly for the reason described above.
>
> This is not a big problem in fact, people can upgrade to PHP5, but
> still using PHP4 syntax. We don't like PHP5 since it is not well
> planned, and subject to change.
That sounds wrong to me. PHP5's OOP is useless only if you don't have
any use for OOP in the first place. You want a struct, use PHP4 OOP,
fine. But if you want actual OOP, use PHP5. I know I couldn't use PHP4
for the database framework I wrote in 5 based on an abstract
superclass.
~A!
Navigation:
[Reply to this message]
|