From php-general Thu Dec 21 02:35:00 2006 From: Niels Date: Thu, 21 Dec 2006 02:35:00 +0000 To: php-general Subject: [PHP] Re: Are PHP5 features worth it? Message-Id: X-MARC-Message: https://marc.info/?l=php-general&m=116666897217909 Hi, On Wednesday 20 December 2006 02:24, Tony Marston wrote: > > "Niels" wrote in message > news:3A.D0.24871.C1A28854@pb1.pair.com... >> Hi list, >> >> I'm writing a PHP program and I've got a number of concerns. The program >> is >> about 20 KLOC at the moment, but will probably grow quite a lot. >> >> I'm using OOP throughout, and I don't really have a lot of problems with >> what PHP4 can do with OOP. PHP5 does have a nice feature or two, >> eventhough >> none seems essential to my particular style of programming. I don't mind >> using what PHP5 offers where it makes sense, but where's that? Exceptions >> and new OOP features? > > I have written a large application which uses the OO features of PHP 4, > and the same code runs untouched with PHP 5. There is no advantage in > making use of some of these fancy new features in PHP 5, so I just don't > bother. > I disagree -- there are definitely advantages, the question is whether they are worth it. I think other answers in this thread bring good points to the table.   >> Exceptions: I just don't see the big advantage. I've got errors and >> messages >> bubbling up through object layers as it is, and exchanging that with a >> wholly new structure seems more trouble that it's worth. I've read >> several books on how cool PHP5 is, but the arguments for using exceptions >> seem to boil down to "Java has them". > > I don't use exceptions for the simple reason that there is no advantage in > doing so. I have a perfectly adequate error handler (just lke you) so > there is no pont in changing it. Java programmers can only program with > exceptions simply because they don't know any better. > >> Nowhere have I seen good examples that really >> show how well exceptions solve real problems, all examples seem to show >> are >> that 5 lines of try/catch are somehow sexier than 5 lines of if/else. >> What about performance? > > I agree entirely. Lots of extra code for absolutely no benefit. > >> New OOP features: I can go through my code and mark all my methods as >> public >> or private or whatever. No problem. But why would I? > > Exactly What does all that effort buy you? Better functionality? Increased > performance? The answer is "nothing". You know that for sure? > All it does is place restrictions on > what other programmers can do when they attaempt to use your code. Lots of > cost with no measurable benefit equates to a total waste of time. > Restrictions do help stabilize the API. >>It will make classes >> easier to understand when I look at them, but that's just convenience. >> What >> are the performance benefits? > > There are no benefits, only restrictions. > >> I've not found a single mention of that >> anywhere. What do abstractions and interfaces actually do, aside from >> structuring my code better? > > Abstractions are thought processes which help you to identify the essence > of what needs to be done, so they are essential. Interfaces on the other > hand are a total waste of time. Other languages have them because of > deficiencies in those languages. PHP doesn't have those deficiencies, so > interfaces are totally unnecessary. > >> What major compelling reasons do I have to start using exceptions and >> OOP-5? > > Absolutely none. > Thank you for your answer, Niels -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php