Re: Raising errors inside a constructor

From: Date: Tue, 17 Aug 2004 14:56:58 +0000
Subject: Re: Raising errors inside a constructor
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32748@lists.php.net to get a copy of this message
Olivier Guilyardi wrote:
Joshua Eichorn wrote:
Olivier Guilyardi wrote:
Joshua Eichorn wrote: Generally using base classes is a bad idea (well in php, something
like
java is a bit different), especially to get rid of static calls which are very readable just a little different if you've never seen them before.
I've seen and used static calls. As less as possible though, since that does not follow the OO paradigm. Java ? Humm... The new features of php5 really remind me of Java (or some other real OO language). Is your above statement still true with php5 ?
php5 might have OO features but there is still quite a bit of overhead in parsing to large object trees. Plus even in java the base class limits your flexability a lot, especially when intergrating classes from other sources. I don't think I would sacrifice flexibility for OO purity but if your going that route at least make the error handling stuff an interface that the base class implements otherwise you end up having to hack 3rd party code instead of just extending it to make it fit. -josh
I see that you answered my question : with php5 interfaces we can do real OO. I'm personally not really concerned by the "overhead" you're talking about, since I work on intranets, and if it gets slow, it usually is a matter of adding a hard disk to a striping RAID. But this is a personal issue... Well im in much the same point as you performance wise, but you do want to be careful to keep response times low, no wants to sititng for 2 seconds between clicks, though thats usually db overhead not php code parsing, unless your on something with really bad file io and very little ram.
But yea my main reason to stay away from a base class is in php4 you don't have a lot of options just extension so you don't want to waste it, if your in php5 of course you might want to look at exceptions, but there use is really a personal preference, some people just don't like using them. -josh

« previous php.pear.dev (#32748) next »