Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7309 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27910 invoked by uid 1010); 24 Jan 2004 03:27:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 27864 invoked from network); 24 Jan 2004 03:26:59 -0000 Received: from unknown (HELO moutng.kundenserver.de) (212.227.126.183) by pb1.pair.com with SMTP; 24 Jan 2004 03:26:59 -0000 Received: from [212.227.126.162] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1AkERm-000118-00; Sat, 24 Jan 2004 04:26:58 +0100 Received: from [217.80.180.206] (helo=[217.80.180.206]) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1AkERm-0004W4-00; Sat, 24 Jan 2004 04:26:58 +0100 To: lingwitt@bellsouth.net Cc: PHP Development In-Reply-To: References: <20040122144819.42410.qmail@pb1.pair.com> <1074892877.252.12.camel@localhost> Content-Type: text/plain Message-ID: <1074914553.252.49.camel@localhost> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Sat, 24 Jan 2004 04:22:34 +0100 Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:e958292ea7b1c44e51b2b9ca0a9da460 Subject: Re: [PHP-DEV] base class From: thekid@thekid.de (Timm Friebe) On Sat, 2004-01-24 at 03:06, lingwitt@bellsouth.net wrote: > So why must we all keep implementing it? Well, because you'd probably not like it the way I'd like to see it (or the other way around), someone else probably prefers PEAR's, Horde's, $random_other_php_framework's solution, and so on. Plus, as was already said, and to which I agree, not every class should have a constructor. If it did, you'd have a noticeable and unnecessary memory overhead, especially when you're creating big amounts of objects. There are more reasons which do not necessarily have to do with performance or memory consumption but rather with how one thinks a base class should be designed - see what I mean by personal preferences? All in all, I don't think it would be a good idea if PHP forced this on you. What would be basically OK if you had the _option_ of having such a base class. But then again, why not simply write one for yourself? It's not like any programmer utilizing OOP *doesn't* use any sort of include(s) in where his/her classes reside. Add it there and you're all set up. It's basically the same with the built-in exception class. I can't have my own (at least not with the sexy-most name "Exception"). Then, in my (very personal) view I want it designed differently, and want to have it extend _my_ base class (which, incidentally, is called "Object" and does _not_ have constructor:)) - again, this is _my_ very personal feeling about how it should be - so I'll just have my own exception, which is perfectly OK and dealt with very well by the Zend Engine. I'm not the only PHP user out there with his or her own understanding of subtleties in class design (new Reflection_Class("xxx") vs. Reflection_Class::forName("xxx"). As for base classes, whip up Google, search for object.php and see for yourself. - Timm