php vs. Java EE
There is a lot of comparison between PHP and Java EE on the Internet, and the following points are nothing more:
1. Language Features
PHP is a scripting language, an interpreted language, and a weak type, built for Web development. Java is a C language System programming language, compiled type, strong type, has cross-platform characteristics. From the syntax of simplicity, PHP is more concise than Java, after all, PHP is born later than Java, the same logic in PHP to express the same simplicity in Java, this feature causes the same proficiency phper and Javaer compared to phper programming faster than Javaer. Here I would like to emphasize the same proficiency, the concept is very important, there is no premise to compare the proficiency of the two programming languages is meaningless, such as a new phper in the development of the PHP language is not proficient, the development process requires frequent access to relevant documents, Then this new Phper development speed certainly compared with the old Javaer, because the new phper in the time to consult the document, old Javaer can completely rely on proficiency to fill the grammatical efficiency difference even more than the new phper.
2. Execution speed
Language features determine the speed of execution, in the execution speed, there are many comparisons on the Internet, in summary, Java is better than PHP, but in fact, compared to the implementation of both the speed is not significant, because the efficiency of the Web application bottleneck in the database related operations, It is important to emphasize that PHP and Java are the same as Web server development language, the function is to operate the database server and Dynamic Web page rendering, if the site most of the form of static pages to the user, the two more meaningless.
3. How to Deploy
PHP is typically deployed in the form of lamp, the Linux system +apache server +mysql Database +php language, and Java EE is deployed in a Linux system +tomcat server +mysql database +java language, The difference is only the server and language choice, Tomcat and Apache are open source free server, from the deployment to speak both languages have a viable solution. But the focus here is the virtual machine host, most of the domestic virtual host does not support Java, even if support Java is also expensive PHP, and Java applications mostly use Tomcat server, and Java Virtual Host is a shared Tomcat process, If other applications deployed to the server affect the Tomcat process, which makes it impossible for all apps to use the Tomcat process, the hosting provider maintains the Java server at a higher cost than the PHP server, so this also leads to PHP's state of being on the web side. Of course, without a virtual host, there is no such concern, such as the use of cloud servers, cloud servers can self-configure the relevant environment, and freedom is a double-edged sword, security but high price. Here Phper and Javaer are different in the programming environment, some people say that PHP can be hot deployment, not like Javaer writing Web applications every time the code needs to switch the server, deploy applications, and then debug, in fact Javaer can also be hot deployment, Only one button is required in the IntelliJ.
4. Team Collaboration
In the promotion of the front-end separation of the Internet environment, the template development mode led to the front-end high coupling more and more people abandoned, today, the Web application backend only need to provide the corresponding data interface for the front-end calls, typical ideas such as restful. So there is not much difference between PHP and Java in the team's front and back. If Web applications consider SEO search engine optimization still adopt template development mode, the PHP language is more friendly to the front end than Java.
5. System Architecture
In terms of system architecture, Java undoubtedly has a clear win, Java has a variety of architecture choices, the common SSH framework is struts+spring+hibernate, SSM is Spring Mvc+spring+mybatis, SM is spring boot+ MyBatis can be used as a framework for Web applications, these frameworks can be very good to separate back-end modules, according to the specific needs of different MVC layer, business layer, the persistence layer framework for development. Some people say that PHP can also be done, that PHP has a lot of frameworks can also be layered architecture, thinkphp is not the Chinese developed PHP MVC framework? There is no doubt that PHP has a framework, but PHP from the language features are not suitable for the framework, the framework and object-oriented programming ideas have a strong connection, and the PHP language features on the object-oriented is not friendly, which led to PHP on the framework this way its ceiling and Java far apart. There is no doubt that some of the phper will be outraged, but it is true that PHP's linguistic attributes are biased and process oriented, which is designed to develop specific business logic, which is why PHP is suitable for web development. Others will say that after PHP5.0 also support object-oriented, but in fact, PHP is the last resort. The object-oriented and process-oriented differences are not listed here, but all in all, for the system architecture, PHP and Java have their own application scenarios, in the absence of assumptions on the situation to compare the two, difficult to distinguish between pros and cons.
Technology selection in the end with PHP or Java EE?
When it comes to this problem, as an application owner, consider the problem nothing more than the following points:
1. Labor cost
Compared to Java, PHP as a newcomer, less than Java in the talent pool is indisputable, in fact, it is related to today's education. Most of today's education system is based on the language of the school programming language, C language department, such as the D/C, C #, Java, so the education of the Web programming language with Java majority. and the language of PHP is mostly in vocational education, there are some in the social education of self-learning. This status also leads to the scarcity of PHP talent in society. The relationship between supply and demand determines the value of human resources, PHP talent price is higher than the Java talent from this also reflected.
2. Project Requirements
In the Web application based on B/s architecture, the complexity of project requirements is relatively large, from the Enterprise display website, personal blog Building, to the e-commerce platform, CRM system, to the financial platform, banking system, the complexity of the project needs to exponentially increase. Coupled with the impact of version change on project requirements during the operational phase of Web applications, Web applications need to build a complete system design at the beginning of development. Similar to the National 5-year plan, the system design in the original version must have a certain space and time assumptions, such as a first design for the Enterprise Display site Web application, in a certain period of time and a certain degree of development under the influence of the enterprise will never jump out of demand and into the banking system. The assumption of such a system design is closely related to the technology selection, while PHP and Java have different application scenarios in the Web domain. Simple system design PHP is perfectly capable, and complex system design means that backend code needs to be modular, low-cohesion/high-coupling, and code reuse, and undoubtedly the object-oriented Java language is better suited to this complex scenario. (You can join the Hobby assembly, exchange together: 342836117) Welcome to Exchange: (858288017)
3. Operating costs
A Web application is always deployed on the web for its users to browse, and the impact of PHP and Java on operating costs can also affect its technology selection. For the operation of Web applications, there are no more than two chunks of deployment and maintenance. The deployment takes into account the server price, and maintenance is concerned with personnel expenses. In terms of deployment, the PHP Web and Java Web are typically deployed in a network of three ways, one is a mirrored deployment, one is a virtual host, and the other is a cloud server. Mirror deployment only needs a computer connected to the network, the virtual host needs to be rented to the host, the cloud server and virtual host also need to rent to the host service providers, the three for different scenarios have advantages and disadvantages, the difference is the server load, stability and security aspects, the detailed difference between the reader can self-Baidu, price , without exception, the Web server to PHP this scripting language is particularly friendly, so the PHP server unified than the Java server is cheaper, maintenance, PHP web and Java Web Maintenance has two directions, one is the application of exceptions, there is a server exception, application exception for developers to debug, Server exception if a mirror deployment allows network administrators to debug with the developer, the virtual host and the cloud server find the appropriate server provider. Operational costs are integrated into the deployment and maintenance considerations: The cost of maintenance can be attributed to the cost of labor in the human cost, and the deployment cost in addition to the image deployment does not need to consider PHP and Java differences, virtual host and Cloud Server deployment PHP is lower than Java.
For a common Web application, such as Enterprise display website, personal blog Building, micro-commerce platform, small ERP, CRM system, technical angle PHP is completely enough, price angle PHP is also cheaper than Java, the development speed PHP slightly better than Java. For a complex Web application, the object-oriented Java will be a choice, although the cost is high, but expensive only one disadvantage, cheap is only cheap one advantage. In particular, I recommend Java for intranet applications, which are Web applications that are based on the B/s architecture but do not hang into the internet.
Write here, some readers may think that the author is the entire article is about PHP better than Java, the author as a Javaer, the intention to state the objective facts of the two languages, it is undeniable that PHP in the web domain alone, and Java is the Web domain enterprise application development of choice. Looking at the social needs of today's Web applications, large project requirements are less than small projects, small projects require fast iterations, and Java servers and deployment costs are high, resulting in few web applications that are truly suitable for Java development. But all in all, PHP can do Java can do, Java can do PHP may not do well, PHP and Java technology selection, and finally need a number of factors comprehensive consideration. In fact, Java as the most robust back-end language has PHP incomparable advantages, object-oriented is the PHP script language does not pass the threshold. I as a developer of Android and Java EE two platform, considering the consistency of programming language, do Web applications, or will use Java, buy a cloud server, one can deploy a project management SVN cloud server, and deploy a continuous integration/ Automated build Server Jenkins or Teamcity, both for the development environment and production environment, although I am not a businessman, but does not mean that I am a fool, the cloud server to spend money to use up, why not?
Turn from: 78993430
Java and PHP for Web development Technology selection