At 08:08 PM 3/27/2003 +0100, Per Lundberg wrote:
> >Of course, it should not be done in a way to break backward
> >compatibility if at all possible.
> I consider having half of PHP throw errors and the other half as throwing
> exceptions to break BC.

Even though we are talking about functionalites (type hints) that was
not even available in previous versions of PHP?

Yep, because I think it's wrong to have a hybrid model and it will confuse the mainstream of PHP developers.



> >This is a very bad idea.  One of the points of exceptions is being able
> >to have a standardized way of handling errors.  I also like the way Java
> >does it: if you don't catch the exceptions your code could throw, your
> >code won't even compile.  Now, I am pretty certain that you would not be
> >happy if I said this would be neat to have in PHP.  :-)  Still, I think
> >it would be great to have it as a configuration directive, because it
> >really is a Good Thing to force programmers to handle errors properly...
> If you are looking for a strictly typed language I'd suggest Java :)

I have used Java to a certain degree (and I think this might be showing
in my way of thinking).  I don't use Java any more; I have moved over to
PHP, both for developing web applications and smaller scripts.  What I
*really* would like to be able to do is to develop larger applications
in PHP.  For this, being able to standardize and even "force" (like in
Java) the code to handle errors is actually a very, very useful
feature.  We've all used badly written programs with few or little error
handling...

Actually I have done quite a bit of Java development myself and I am not 100% convinced that the fact that it forces you to handle exceptions always achieves the purpose. I've seen too many Java developers catch exceptions the following way:
catch (Exception e) {
}


Anyway that's not the issue nor my point :)

> >It is true that many people still write imperative (function-based)
> >code. But that is no argument for not making PHP a really, really good
> >Java-killer. And, standardized exceptions is really one of the things I
> >find absoutely best in Java.
> We are not in the business of killing Java. We are in the business of being
> the best web programming language.


Like Java. ;-)

Seriously: the Java people are working hard to make Java be the best web
programming language.  Not *only* a web programming language, of course,
but JSP, servlets and EJB (Enterprise Java Beans, persistent objects)
are striving to provide an excellent web platform.

I somewhat disagree. The Java companies know that EJB isn't suitable for the mainstream Java web sites. It is mainly useful for real enterprise applications such as banking systems and it's development overhead is extremely high and expensive. JSP and servlets are aimed at the web but I think the reason for PHP being much more popular than Java on the web is due to its simplicity. The main issue in the web is constant change and therefore time-to-market is extremely important.



The only big problem is that it is sooooo much slower than PHP...  and
this is one of the main reasons why I have abandoned Java and JSP for
web development.

Slow as in performance or development time? In my opinion the problem is development time and therefore I think if we move too much towards Java we will be bitten by the same problem.



> One is a strictly typed compiled language and the other (PHP) a dynamically
> typed scripting language. The reason for PHP's wide adoption is its ease of
> use, especially vs. strongly typed languages such as Java. I want to keep
> this advantage.


I understand that, and I don't want to make PHP harder to use.  I hope
this is not the impression I am giving.  I just want it to be easy to
use for power users *as well* as new users, and friendly when writing
big, enterprise-class applications, applications that benefit greatly
from standardized error handling.

In general, I think the current features in PHP 5 give you a huge amount of options, including to power users. I don't think adopting most of the subtle features of Java will make as much of a significant difference but will likely add bloat and complexity which will end up decreasing PHP applications's time-to-market. I think the fact that the user land code can use exceptions is the main advantage.



> >Many of the OOP problems of PHP4 have already been fixed
> >in PHP5.  Yet, there is still some room for improvement.
> You might call it improvement and some might call it bloat.

Yes, possibly.  The thing is, I consider OOP to be so much more than
"syntactic sugar".  It is a really helpful paradigm for helping avoiding
many of the common programming mistakes.

Yes, and in my opinion the CVS contains the important features which allow you to write nice OOP programs. We've solved the real bad issues of OOP in PHP 4 and have added all of the important features and some on top :)


> >Just my $0.02.  ;-)
> That was more like $10.00 :)

Yeah, that's why I wrote a smiley. :-)

I know :)


Signing off for tonight....
Andi


-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to