FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » out of sheer curiosity...
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: out of sheer curiosity... [message #177439 is a reply to message #177436] Thu, 29 March 2012 20:11 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 3/29/2012 10:21 AM, Erwin Moller wrote:
> On 3/29/2012 3:39 PM, Jerry Stuckle wrote:
>> On 3/29/2012 8:33 AM, Erwin Moller wrote:
>>> On 3/29/2012 12:46 PM, The Natural Philosopher wrote:
>
> <snip>
>
>>>> Its just another way of doing things and I let my understanding of the
>>>> problem guide me, not a set of arbitrary rules.
>>>
>>> As it should!
>>>
>>> But what 'rules' are you referring to?
>>>
>>> PHP's OO is pretty straightforward.
>>> I think they did a decent job implementing OO.(php 5 that is)
>>>
>>> Creating smart classes is up to the programmer.
>>> I am not aware of any extra 'rules'.
>>>
>>> Are you maybe referring to all kinds of design patterns scattered around
>>> the web?
>>> (In which case I tend to agree, because implementing other people's
>>> solutions can take the fun out of programming. But reading them never
>>> hurts. And when you agree to a certain approach you can even decide to
>>> follow it yourself. It is all up to you, the programmer.)
>>>
>>
>> Any rules TNP doesn't bother to understand are "arbitrary" in his mind.
>> He doesn't even like having to follow PHP syntax rules - as he has also
>> said in the past.
>>
>> But I disagree that PHP 5's implementation of OO is decent. I think it's
>> half-assed at best. Truly written by people who have no understanding of
>> OO. But then that can be said of a lot of PHP.
>>
>
> Jerry,
>
> What are your main objections to the PHP5's OO approach?
>
> For myself: I must say I love its simplicity.
> (Simplicity is a Good Thing in my opinion.)
>
>

Well, to start with, the lack of function overloading. It is quite a
good feature to be able to overload functions - especially constructors.
And because of that, you have to run through all kinds of hoops when
doing things like storing an object in the $_SESSION.

Even then it doesn't work. When you store an object in the $_SESSION,
the object's destructor is called at the end of the script, but on the
next script the constructor is never called. A direct violation of OO
principles.

Inheritance is also screwed up. You should never have to call the
constructor of the parent object from your child's constructor. It
should be automatic.

Polymorphism works half-assed, but again you need to run through hoops.
For instance, base class has static method "foo". It also calls
static method "bar". Derived class also has method "bar". If you call
derived::foo(), you will end up calling Base::bar() instead of
Derived::bar(). They fixed this in 5.3 by forcing (yet another!) use of
the keyword static - instead of making the code work transparently.

There are all kinds of similar things in PHP. But that's not really
that surprising to me.

>
> <snip>
>
>>>>
>>>> (and almost all of the problems to which PHP is the natural language of
>>>> choice do not benefit from OOP. If a web site is the application each
>>>> php 'page' is an object in its own right..anyway.
>>>
>>> True for a simple plain webpage, but when you have something more
>>> complex OO can certainly help.
>>> Most (all?) modern MVC software are at least partly OO, simply because
>>> it makes things easier to organize.
>>>
>>
>> No, a page is not an object. A page is closer to a transactional
>> application. For instance, the page cannot be reused in another page
>> without modifications. Objects can.
>>
>
> No, of course a page is not an object in the OO meaning.
> I was referring to using OO to help building the page.
>
> I wonder: one might defend that storing serialized objects in a session
> is object persistence, and that a page is hence also part of it because
> it is coupled via sess_id to that object.
> Nah.. too farfetched.
> (And I never store objects in a session anymore: not worth the trouble
> in my opinion.)
>
> <snip>
>

Storing the object in the $_SESSION is object persistence. But that
doesn't make the page itself an object in the OO sense, any more than MS
Word is an object because you can store a document on disk for later
retrieval.

And I agree about storing objects in the session (see above). But that
also means even more hoops you have to run through to store and retrieve
your object.

>>
>> I can code Intel processors - I started back in '82 when the typical PC
>> had 64K or 128K of RAM (and slow). We needed to do some stuff in 808x
>> assembler. I still do a little as a hobby (mainly to keep up with it),
>> but I don't go down to the OS level.
>>
>
> Nice!
> And I feel like a relic now with my 6502 hands-on experience. ;-)
>
> Regards,
> Erwin Moller
>

I should add, I never did any 6502. I did some 6800 back around 1980 or
so, and have done lots of IBM Mainframe assembler (and even a fair
amount of machine code - their instruction set makes it relatively
easy). But never had the opportunity to do anything on the 6502.

I have mixed feelings about assembler. It's nice when you need the
speed and/or memory, but those aren't so much of a problem nowadays.
But it really is a bear to try to do anything more than adding a couple
of registers together :)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 5.4 windows installer.
Next Topic: Does PHP5 treat $_SERVER['PHP_AUTH_USER']) differently?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 08:30:38 GMT 2024

Total time taken to generate the page: 0.04872 seconds