Some things that Java can do cannot be done with Php, or can only be done with the help of other tools. But when it comes to developing websites, Php is indeed more efficient than Java. , especially relatively simple projects.
First of all, the architecture of Java is more complicated than Php. Let’s not talk about various development frameworks. Jsp and Class files should be separated. ORM should be used to connect to the database. Compare the versions of various commonly used open source packages. , the lower layer of the http server needs a servlet container. The Php architecture is very simple. In theory, just write the Php file and put it in the http server. Reading and writing the mysql database requires almost no additional tools. As for MVC, developing serious projects requires both Php and Java. Object-oriented programming in Java must always be adhered to, while PHP often only partially does this, and most of the rest adopts a process-oriented approach (although this part is often also disguised as object-oriented).
Second, Php uses weakly typed variables. No matter what variable you want to define, a $ is enough, and there is almost no need to worry about conversion issues. Java does not, numbers are numbers, strings are strings, this is Java One reason for high efficiency is also a reason why development is slower than Php.
Third, PHP can support hot deployment, but JAVA needs to be recompiled. After modifying a piece of code in PHP, you can see the results after publishing it, which saves a lot of maintenance work.
Fourth, low-cost Java projects cannot solve the problem of high concurrency of the website. It is very difficult for a single Tomcat, Jetty or Jboss to support 1,000 concurrencies. Not to mention nginx that supports php, even apache cannot compare.
Of course, it is different if you invest more than one million in weblogic. Note that this over one million is invested in the httpd server and servlet container alone, and has nothing to do with the specific development.
The computing efficiency of Java is higher than that of Php, but a large number of operations in website projects occur at the database level, and this advantage of Java cannot be used. For example, there are 100,000 articles, and comparing their relevance, Java is much more suitable for doing this than Php.
For more PHP related knowledge, please visit php中文网!
The above is the detailed content of Which development efficiency is higher in php than java?. For more information, please follow other related articles on the PHP Chinese website!