Re: Are PHP5 features worth it?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nauman Akbar wrote:
> Hello!
> 
> Let us consider my scenario. I am developing a XML based web service. Using
> pre PHP 5 features, I am stuck with DOM, SOAP or plain old XML parser. Too

the DOM extension is php5 only! it replaces DOMXML.

again the SOAP extension (very nice it is too) is php5 only. (in php4 you
were stuck with doing the SOAP by hand (or using someone's userland implementation)

> cumbersome - eh.
> 
> I specifically upgraded my server to PHP 5 to make use of SimpleXML. I am

I found DOM to be easier to use than SimpleXML (but that was due to the
fact that it was impossible to inspect the structure/content of SimpleXML objects
using var_dump(), print_r(), etc - I believe this has since been fixed satisfactorily)

> sure there are many other packages that are only supported on PHP 5 and are
> quite useful.

indeed! ...

http://php.net/manual/en/ref.datetime.php
http://php.net/manual/en/ref.stream.php (exists in php4.3+ but improved/extended in php5)
http://php.net/manual/en/migration5.functions.php
http://php.net/manual/en/ref.mysqli.php	(for connecting to mysql4.1+)
> 
> I presume that is a good enough reason :). Forget about OOP and exceptions.

while I agree that exceptions don't really offer anything that couldn't be done
with 'std' error handling - it does offer an alternative which some people might prefer ...
having the choice is nice in and of itself.

I wouldn't recommend forgetting OOP - the OO functionality in php5 is an improvement
in terms of proper ctors, PPP, 'overloading', and that objects are always by reference (and not by value
as in php4) - allround I would suggest php5's OO model is a big step forward even though it
entails that you will have to be a bit more strict with regard to how you write you OO code.

	http://php.net/manual/en/language.oop5.php

obviously choosing OO over procedural style, or vice versa is a question of taste
(I use both depending on the needs, time of month, my mood :-)

> 
> Regards
> Nauman Akbar
> Concise Solutions
> 
> -----Original Message-----
> From: Niels [mailto:zorglub_olsen@xxxxxxxxxxx] 
> Sent: Tuesday, December 19, 2006 11:05 PM
> To: php-general@xxxxxxxxxxxxx
> Subject:  Are PHP5 features worth it?
> 
> 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?
> 
> 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". 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?
> 
> 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? It will make classes
> easier to understand when I look at them, but that's just convenience. What
> are the performance benefits? I've not found a single mention of that
> anywhere. What do abstractions and interfaces actually do, aside from
> structuring my code better?
> 
> What major compelling reasons do I have to start using exceptions and OOP-5?
> 
> 
> Thanks,
> Niels
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux