Home >Backend Development >PHP Tutorial >The obvious difference between php and java development languages
1. Origin
Java was originally designed to develop a distributed code system for home consumer electronics; PHP is for the Internet. Born of application.
2. Comparison of the technical architecture of the system
PHP: Layering is a way to effectively organize the system. The idea of divide and conquer is a very important idea in the computer field. Under the guidance of good layering ideas, "high cohesion and low coupling" can be achieved, and specific problems can be separated, making it easier to control, extend, and allocate resources.
Developed using PHP language, it can perfectly realize the layered thinking of multi-layer architecture distribution. Under the guidance of the layered thinking, it can achieve "high cohesion and low coupling", and can also separate specific problems and make them easy to control. , easy to extend and easier to allocate resources.
JAVA: Gutmans published an article the year before last, which also elaborated on the comparison of multi-threading (JVM) and multi-process (LAMP) in a multi-core environment. Among them, it is mentioned that multi-core systems are very suitable for the multi-process approach of the LAMP architecture.
As the chip industry now focuses on multi-core rather than hyper-threading technology, the advantages of a multi-threaded environment like the JVM will not be fully utilized on today's hardware. The multi-process approach will provide more stability and reliability.
3. Database access comparison
PHP can be compiled into functions that connect to many databases. You will write your own peripheral functions to access the database indirectly. In this way, when the database used is changed, the coding can be easily modified to adapt to such changes. At the same time, the current PHP provides a unified interface for databases. Access to different databases such as Oracle, MySQL, SQL2000, etc. can be completed through the bridge without considering the database interface issues.
Java accesses the database through JDBC and accesses the database through database drivers provided by different database vendors without any special targeted optimization. If the developed web application is also converted from MYSQL data to ORACLE data, PHP uses the PDO interface, and almost no program modifications are needed, while Java development requires certain changes to achieve it.
The difference in database access methods has established the gap between e-commerce software developed by PHP and e-commerce software developed by Java. Java is the traditional generation, but PHP is the result of the development of new technology. , PHP can not only accommodate everything, but also steadily improve in speed, and its efficiency is much more powerful than Java. This round, Java is slightly less impressive.
4. Security comparison
Open source is the biggest advantage of security, and LIUNX is a very successful proof. The PHP development program can be easily modified after others get the code. Programs developed in Java cannot see the complete source code and can only see some compiled class files. Therefore, many hidden dangers of the underlying architecture cannot be predicted in advance. Once a catastrophic error occurs, the consequences will be severe. serious.
If you want to encrypt PHP code, you can also use Zend's authoritative product zend guard for encryption to ensure the intellectual property rights of the product. If we have to compare PHP and Java in terms of security, we can only say that they are about the same. If there is a gap, it is also determined by the level of the development programmers. In this round, the two are still evenly matched.
5. Foresight and expandability in the direction of Internet applications
On the whole, PHP is suitable for Internet applications, while the Java language was not designed at the beginning. It is not centered on WEB, but on general services. PHP can make the most of Internet applications, and Java is catering to the needs of WEB applications through standard or non-standard frameworks. First of all, PHP can adopt distributed deployment for large system loads. Separate the database, application logic layer, and presentation logic layer from each other, and separate the same layers based on traffic. PHP does an excellent job in this regard.
Java can also obtain scale support through Class and EJB, and structure support through EJB/CORBA and ApplicationServer from many vendors. In terms of communicating with existing Java or .NET applications, PHP can communicate through existing API interfaces. As for the data used in data communication, it is nothing more than XML, JSON, etc. In fact, Java has been deeply rooted in enterprise-level E-ization and key business applications. However, in Web applications, the market share of the Java language has dropped sharply, and the decline is obvious.
6. Comparison of development and subsequent maintenance costs
Since PHP is stronger than Java in many aspects of Internet applications, why are e-commerce products developed by Java different from PHP products? What about competition? This is because the Java camp generally takes the government line, while the PHP camp takes the national line. PHP has a low entry barrier, but becoming a master in any aspect is one of the best. The vast majority of programmers who have learned C can easily transform into PHP programmers, which makes PHP programmers as popular as national sports. There are also many experts, and high-quality PHP software products are emerging in endlessly. In comparison, the cost of JAVA is much higher than PHP.
7. Degree of productization
When developing in Java, almost no programmer will start from the bottom, because they are all encapsulated classes. This is actually an important reason why it is difficult to productize Java. Because almost all programmers can do relatively shallow application development. As far as Java classes are concerned, when placed on the Internet, there is only one thing that can be described as heavy.
As most business applications including CRM, ERP, reports, document management, etc. have also turned to the Web, looking around, there are a dazzling array of PHP products. In terms of Internet applications, it can be said responsibly that, The coverage rate is above 99%. Although the quality of many products varies, there are some representative products in each direction and field.
The degree of productization is an important data that directly supports the degree of industrialization. Tools that cannot be industrialized are actually very sad in themselves.
Recommended tutorial: PHP video tutorial
The above is the detailed content of The obvious difference between php and java development languages. For more information, please follow other related articles on the PHP Chinese website!