|
Posted by Colin McKinnon on 10/13/24 11:19
Chris Hope wrote:
> Erik Funkenbusch wrote:
>
> [snip]
>
>> PHP, while popwerful, does suffer from some serious and often cripling
>> flaws. It really takes some of the worst features of almost very
>> lanugage it steals ideas from.
>
> I won't disagree there are some/many flaws in PHP. In particular is the
> lack of consistancy of function naming and order of parameters to a
> function, and the lack of namespacing which they seem determined to not
> implement ever.
>
I'm not trying to propogate a flame war - I think this kind of debate is
good and educational.
I must disagree though about the aspersions being flung about here. There
was some very well-argued debate regarding typing on the list recently.
Some poeple like strong typing, some like dynamic typing, some liked other
flavours. Most agreed that the approach taken by PHP wasn't instrinsically
flawed in any way - but some felt more at home with other approaches to the
issue.
I think PHP would benefit from changes to the things Chris explicitly
mentions - i.e. case sensitivity in function names and some way of better
managing the namespace. And the change to object references, and the
try...catch construct in PHP 5 is very welcome. But beyond that, I can't
think of anything within PHP which I think is poorly designed - I don't
feel like I'm making a compromise by developing in PHP rather than Perl or
Java or C.
If you think differently tell us why.
> They tend to break a lot of
> things from version to version. This makes it much harder to make your
> app run on all versions, or even keep up with the latest version.
I've already mentioned there are some fundamental things which changed from
4 to 5. But IMHO PHP is a lot more 'stable' in this regard than a lot of
other tools. Admittedly Perl, Java and C have seen little change in recent
times but can the same be said of *anything* out of Redmond? Have you
started migrating to Apache 2 yet? What about Linux - its had 3 different
firewall tools in the last 4 major revisions - and the process and I/O
schedulers keep changing too.
What I keep coming back to is this: PHP doesn't define architecture, it
doesn't define the rules by which you build applications - should it? Even
using a different set of tools, you need to integrate development with
testing. Both unit testing and integration testing (preferably continious
integration). PHP allows these structures to evolve - because I don't think
they are mature yet for any platform.
Consider this example - suppose we have a function like strtok() - i.e.
splits up a string 'subject' using a string 'div'. It doesn't matter if the
typing of the language is strict and static, if it is compiled or
interpreted, the language can't spot the difference between:
my_split(subject, div)
and
my_split(div. subject)
> I would be a lot happier with PHP if they offered more instruction to new
> developers, defined best practices, and didn't have 30 ways to do the same
> thing.
I wouldn't. There are a lot of things that need to be learnt about how to
use PHP but for the PHP developers to take responisibility for this may
lead to the language being restructured to fit in with the 'rules' when the
'rules' themselves may be flawed. I also think PHP has got the balance
right between simplicity and functionality.
I try to stick to the PEAR style guidelines - but mostly I don't use PEAR
classes in my programs. I use PHPDoc and phpunit. But I know why those
tools are important. To say to a new developer - you must write your code
this way, using these tools and practices just creates boundaries to
participation.
C.
Navigation:
[Reply to this message]
|