0 Basics of learning php or java
A simple comparison between PHP and Java
The e-commerce software on the market can basically be divided into two camps, namely the PHP camp and the Java camp. However, for users who have not been exposed to e-commerce for a long time, they often see only their appearances and obvious price differences, but it is difficult to see the actual differences between them.
In fact, the efficient development and high-quality features of PHP MySQL have made Java, which is popular on university campuses, increasingly embarrassing. As for PHP, why did MySQL come from behind and take the lead in the course of history? Why does e-commerce based on Java architecture have a bleak future in addition to high development costs? First of all, you must understand the difference between PHP and Java.
1. Origin
Java was originally designed to develop a distributed code system for home consumer electronics products; PHP was born for Internet applications.
2. Comparison of the technical architecture of the system
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.
Since PHP5 version, PHP has also made a qualitative leap in system architecture. ShopNC is developed using PHP language, which can perfectly realize multi-layer architecture distribution. Using the MVC design pattern, e-commerce software can have a more efficient and reasonable system architecture. This makes the system's scalability and demand adaptability comparable to e-commerce software systems written in Java.
Gutmans published an article the year before last, which also elaborated on the comparison between 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. In this round, PHP was victorious.
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, current PHP provides a unified database interface PDO. Access to different databases such as Oracle, MySQL, SQL2000, etc. can be completed through the bridge without considering the database interface issues.
At the same time, in order to better support the MYSQL database, PHP also launched the MySQLi database connection, which is more efficient and secure. Java accesses the database through JDBC and accesses the database through database drivers provided by different database vendors. There is no special targeted optimization. If the developed web application is also transferred from MYSQL data to ORACLE data, PHP uses the PDO interface, and there is almost no need to make program modifications (ShopNC has already developed a self-developed encapsulated database layer, which can already complete the processing of multiple data). kind of database support, even without PDO).
Java development requires certain changes to be implemented. 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 technologies. PHP can not only accommodate all things Moreover, the speed has been steadily improved, and the 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. 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.
Why is PHP suitable for Internet applications?
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.
Secondly, PHP provides numerous database interfaces and unified interfaces. It does not take a lot of effort to unify data from multiple different databases. Java can also obtain scale support through Class and EJB, and structural support through EJB/CORBA and Application Servers 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.
If PHP is compared to the best performance award on the Internet, it has the ability to stand alone. Then Java should win the award for the least innovation, just like the European medieval warriors, with only heavy frameworks and cumbersome efficiency. No wonder even SUN back then also supported JRuby and Jython in its J2EE solution. IBM Websphere realized that J2EE was not suitable for WEB and started the Project Zero project. The results of it? The chief architect of Project Zero also reluctantly admitted publicly that "Java can now be considered just a system language and not suitable for building Web applications."
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 fully apparent. So in this round, Java lost speechlessly.
6. 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 put on the Internet, there is only one thing that can be described as heavy. The only cross-platform superiority that Java has always claimed is actually a kind of propaganda for beginner programmers. For senior programmers, it is a joke and a piece of cake. Senior developers who have experienced many large projects know that at the beginning of development, the platform on which the program needs to run is determined. The larger the project, the more certain it is, and platform transplantation will not be easily considered. Even if new services need to be set up on other platforms, additional items will be developed on the new platform, and the connection with existing products can also be solved through Webservice. And the database doesn't matter. I don’t think anyone will use ACCESS to develop large-scale commercial programs!
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. Examples include WordPress, Drupal, mediaWiki, osCommerce, SugarCRM, Discuz, QeePHP, ShopNC, etc.
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. In this round, Java lost completely.
7. 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. Java relies on the words and deeds of university teachers to roar in the Internet world, while PHP relies on its own quality to win the hearts of the people, so it is praised all the way.
The price of software is largely linked to its own cost and functionality. 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 terms of server cost, PHP’s most classic combination is PHP MySQL Apache, and Java is often combined with MySQL Tomcat, JBoss and other software. All software is open source and free, so the investment on the server side is not high.
The learning cost of Java programmers is several times that of PHP. The reason is also very clear. Java itself is not specifically used for WEB development. Therefore, the cost of developing e-commerce in Java is much higher than that of similar software products developed in PHP. However, precisely because the cost of Java development is high, it often takes N times more time and economic cost to develop the same product to achieve the same effect than PHP development. This directly causes a huge waste of time and cost. In the last round, Java lost completely in the WEB battle.
Through the above data, readers can also clearly realize that purchasing Java-based e-commerce products will bring you much economic costs and precious time in the subsequent maintenance period. Business opportunities are fleeting. If business operations always have to wait for a long time for technology to be realized, then I am afraid that the day lily will be gone.
Don’t be afraid of not knowing the goods, but be afraid of comparing goods. Products developed in PHP are widely used and have a good reputation, but products developed in Java are difficult to scale, which directly leads to fewer products and more project types. It is precisely because the overall performance of products developed for PHP has been tested and improved by thousands of users. Java is far from it, so it is not surprising that Java can only take the government route and use the price gap to balance the mentality of the purchaser.
Summary:
PHP is the most powerful promoter of e-commerce software development, and it will inevitably become the general trend. It is irreversible and cannot be questioned. . As programmers, whether it is PHP or Java, the issue of height is actually the same for us. The war at this level is actually a matter between the major manufacturers and has nothing to do with us. But for example, the WEB aspect. I still want to cheer for my camp!
Recommended tutorial: PHP video tutorial
The above is the detailed content of 0 Basics of learning php or java. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

Capsules are three-dimensional geometric figures, composed of a cylinder and a hemisphere at both ends. The volume of the capsule can be calculated by adding the volume of the cylinder and the volume of the hemisphere at both ends. This tutorial will discuss how to calculate the volume of a given capsule in Java using different methods. Capsule volume formula The formula for capsule volume is as follows: Capsule volume = Cylindrical volume Volume Two hemisphere volume in, r: The radius of the hemisphere. h: The height of the cylinder (excluding the hemisphere). Example 1 enter Radius = 5 units Height = 10 units Output Volume = 1570.8 cubic units explain Calculate volume using formula: Volume = π × r2 × h (4
