I tried to get a comparasion between PHP and JSP from a professor who taught both of them.
He told me that the Pro for PHP is that it is "tuned" for web programming so it is always easy to use and quick to find what you need.
However, he mentioned the following three cons for PHP also.
1. PHP is not object oriented.
However, I do find a chapter named "classes and objects" in PHP manual. Is PHP beginning to be object oriented? Even though I know the concept of OOP is popular, my coding never benefited from it. What is the opposite term for "OOP"?
In my understanding, in OOP, other people write some general classes, then you can import and use it through the provided interface, but you will not and do not need to see the source code. In the none-OOP world, if you want to use another class/function/method, you need to add/include the source code into your own code and modity to suit your need. Am I right?
2. PHP is intepreted, not compiled, therefore, slower than C, Java.
What does "intepreted" exactly mean? For each request, the code is coverted from php language to machine language?
3. PHP is not scalable to enterprice level as Java does.
Why this is the case?
I really love PHP and want to see evidence that it is strong.
Please comment.
Jie Huang
three cons of PHP?
Moderator: General Moderators
1. What is the opposite term for "OOP"?
- Procedural programming, such as C. However PHP is not a true OO language but it does let you perform OO programming.
2. What does "intepreted" exactly mean?
Java is compiled and then interpreted at run time, it is the slowest of languages as far as I am concerned because the Garbage Collector takes up 30%-40% of run time.
3. PHP is not scalable to enterprice level as Java does, why?
Can't answer that one.... hope this was helpful to you.
- Procedural programming, such as C. However PHP is not a true OO language but it does let you perform OO programming.
2. What does "intepreted" exactly mean?
Java is compiled and then interpreted at run time, it is the slowest of languages as far as I am concerned because the Garbage Collector takes up 30%-40% of run time.
3. PHP is not scalable to enterprice level as Java does, why?
Can't answer that one.... hope this was helpful to you.
Re: three cons of PHP?
Compared to Java, PHP has less support for the full range of OOP practices. PHP still has a middling/decent level of OOP support and I take advantage of it. Often OOP is contrasted with "Procedural Programming", but its not really an opposite. And OOP still uses PP in places.jiehuang001 wrote: 1. PHP is not object oriented.
However, I do find a chapter named "classes and objects" in PHP manual. Is PHP beginning to be object oriented? Even though I know the concept of OOP is popular, my coding never benefited from it. What is the opposite term for "OOP"?
In my understanding, in OOP, other people write some general classes, then you can import and use it through the provided interface, but you will not and do not need to see the source code. In the none-OOP world, if you want to use another class/function/method, you need to add/include the source code into your own code and modity to suit your need. Am I right?
As to how you use it, you always need either a linked library or the source code regardless of OOP or non-OOP. However, OOP often make it easier to sub-class (extend) a class for which you don't have code. However, there are design patterns for doing the same in a PP paradigm as well.
In any case, good design is good design. OOP helps promote good design, but its not a panacea.
Interpreted mean that the script is converted from source code to machine code, "on-the-fly" on each page view. Compile means that the source code is rendered down to machine code in advance of the first run and saved for future use. Java is actually an intermediate -- its compiles to byte-code that is then interpreted. Zend produces various add-ons that can simulate a similar speed up of partially compiled PHP code.2. PHP is intepreted, not compiled, therefore, slower than C, Java.
What does "intepreted" exactly mean? For each request, the code is coverted from php language to machine language?
Define "enterprise". Define what part of Java you are refering to? PHP scales just as well as Java. J2EE as an enterprise framework is more mature than any similar thing for PHP and there is more specialized hardware/software for J2EE than for anything PHP related. But that's not a fundamental aspect of the languange.3. PHP is not scalable to enterprice level as Java does.
Why this is the case?