`
cppmule
  • 浏览: 446376 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

晚上google的时候看到了一个国外的一篇java与php在web应用领域的对比,有点意思。分享给大家 Comparison of Java and PHP f

阅读更多
晚上google的时候晚上google的时候看到了一个国外的一篇java与php在web应用领域的对比,有点意思。分享给大家
Comparison of Java and PHP for Web Applications
July 9, 2008 by Fabian Lange
No other language has been causing controversial discussions for a long time as PHP. The codecentric GmbH has specialized in Java, so we get some requests for migration of PHP applications.

This involves often the question of whether Java is better than PHP, which is actually not the main problem. Both in Java as well as in PHP, there are frameworks, designed to create Web applications. Frameworks can of course offset drawbacks of language, but also deny benefits of languages.

To understand the comparison of Java and PHP we must go back in time to about the year 2000. Java brought with Servlets and Struts first concepts for Web applications, but to create, configure and deploy them was very complicated. With the boom of the Internet, a new developer community grew, which quickly learned HTML. But pure HTML limits the possibility of interaction and CGI-Perl scripts were cumbersome and difficult. PHP, however, offered an elegant and simple way, if we wanted a date in a web page, we renamed “.html” to “.php” and inserted where wanted <?php echo date ()?> . On Apache Webserver, which already was prepared for PHP, the new file worked out of the box.

Although in Java Server Pages the ability to use scriptlets also did exist, this was frowned upon as unclean. Instead, the Java community advocated the use of components. In my opinion, a critical factor for the categorization of Java as “Enterprise”.

For Internet applications a beautiful design is more important than a functional, as it attracts more customers. While HTML built in Dreamweaver or Front Page by the designer could be easily expandable with dynamic functionality by PHP developers, Java component oriented frameworks could not really work with it. PHP could enrich design with functionality. In Java, however, one had to beautify the functionality.

But in recent years both sides improved. Java reduced the complexity, frameworks like Tapestry or GWT, permitted by templates created by designers. PHP learned with version 5 useful object orientation and frameworks such as Zend or symfony brought design concepts to PHP developers. Also additional libraries of Java found correlation to PHP. For example the PHP ORMs Propel and Doctrine.

From today’s point of view also offer Java and PHP similar functionality. Nevertheless, other aspects are to consider:

Stability
PHP has in my opinion, significant weaknesses. The procedural backward compatibility, no real deprecation mechanism, a mess semi platform independent libraries and functionality are just some of the issues the PHP. PHP lacks a clean cut, which the PHP planned to do with version 6.
Java, however, has a clean platform independence and a fairly well-defined number of core libraries with appropriate quality standards.
Performance
While Java was formerly often described as slow, today’s JVMs are highly optimized for speed, while the script languages, including PHP, still struggle with this. For example a first usable garbage collector will be shipped with PHP 5.3. Also other optimizations were moving very slowly into PHP Runtimes. This might be due to the fact that PHP in contrast to Java restarts the VM after each request, which of course brings additional performance problems. For example for each request session data has to be read from disk. Although there are solutions in PHP (MemCache, APC) these are rarely and partly still heavily in development.
Interestingly, this drawback makes scaling of PHP applications fairly simple. As completely separate requests can be processed, additional hardware results in relatively linear improvements in the capacity of the server. On the Web, the focus is rather on the number of requests, not directly on the exact duration of an individual requests.
Choice
Ideally, you never will re-invent the wheel. It makes sense to look for already existing solutions. Both in PHP, as well as in Java, there is a lot of modular software, partly with free, partly with non-free licenses. However, PHP modules expose significantly more problems than those written in Java. For example, some PHP module developers invented own concepts (e.g. Zend Loader was created by Zend as a substitute for packages) or the modules are only optimized for a framework (like symfony plug-ins).
Java is, especially through the “complicated concepts” such as Class Loading and packages, better prepared for modularization. Due to better tool support (Ant / Maven, Javadoc, JUnit) Java Frameworks have easier to install, better documented and tested artifacts. However PHP tools for these tasks are also on the rise (pake / phing, PHPDocumentor, PHPUnit / lime).
Integration
Integration is certainly the strength of Java. On the one hand, Java itself is almost “Industry Standard”, on the other hand, there are many standards implementations in Java. If a PHP Web application should communicate with a specific protocol, the selection of libraries is rather limited. Even worse, implementations are either only partially implemented or very rudimentary (such as Zend OpenID). Integration of PHP applications with other services usually happens through the database layer.
Developer know-how
Even 20 years ago, Frederic Brooks searched for the “Silver Bullet” and did not find it. In his article he came to the conclusion that software design, problem formulation and the capabilities of the developers are far more important than tools or languages. Therefore, it is certainly a good idea to implement a website by a designer with knowledge of PHP with a state of the art PHP Framework. If it would be a Web front-end of a Java EE backend application Java would be the obvious choice.
However developer knowledge should not hide the fact that some technological hurdles can be overcome only with certain technologies or other languages. So consulting an expert with specific skills makes much more sense than to give it a try with inadequate tools.

So I conclude that Java is still the better choice for many projects. For smaller projects that can be isolated scripting languages might reach the target faster. As a compromise you might give Groovy Grails a try?。分享给大家
Comparison of Java and PHP for Web Applications
July 9, 2008 by Fabian Lange
No other language has been causing controversial discussions for a long time as PHP. The codecentric GmbH has specialized in Java, so we get some requests for migration of PHP applications.

This involves often the question of whether Java is better than PHP, which is actually not the main problem. Both in Java as well as in PHP, there are frameworks, designed to create Web applications. Frameworks can of course offset drawbacks of language, but also deny benefits of languages.

To understand the comparison of Java and PHP we must go back in time to about the year 2000. Java brought with Servlets and Struts first concepts for Web applications, but to create, configure and deploy them was very complicated. With the boom of the Internet, a new developer community grew, which quickly learned HTML. But pure HTML limits the possibility of interaction and CGI-Perl scripts were cumbersome and difficult. PHP, however, offered an elegant and simple way, if we wanted a date in a web page, we renamed “.html” to “.php” and inserted where wanted <?php echo date ()?> . On Apache Webserver, which already was prepared for PHP, the new file worked out of the box.

Although in Java Server Pages the ability to use scriptlets also did exist, this was frowned upon as unclean. Instead, the Java community advocated the use of components. In my opinion, a critical factor for the categorization of Java as “Enterprise”.

For Internet applications a beautiful design is more important than a functional, as it attracts more customers. While HTML built in Dreamweaver or Front Page by the designer could be easily expandable with dynamic functionality by PHP developers, Java component oriented frameworks could not really work with it. PHP could enrich design with functionality. In Java, however, one had to beautify the functionality.

But in recent years both sides improved. Java reduced the complexity, frameworks like Tapestry or GWT, permitted by templates created by designers. PHP learned with version 5 useful object orientation and frameworks such as Zend or symfony brought design concepts to PHP developers. Also additional libraries of Java found correlation to PHP. For example the PHP ORMs Propel and Doctrine.

From today’s point of view also offer Java and PHP similar functionality. Nevertheless, other aspects are to consider:

Stability
PHP has in my opinion, significant weaknesses. The procedural backward compatibility, no real deprecation mechanism, a mess semi platform independent libraries and functionality are just some of the issues the PHP. PHP lacks a clean cut, which the PHP planned to do with version 6.
Java, however, has a clean platform independence and a fairly well-defined number of core libraries with appropriate quality standards.
Performance
While Java was formerly often described as slow, today’s JVMs are highly optimized for speed, while the script languages, including PHP, still struggle with this. For example a first usable garbage collector will be shipped with PHP 5.3. Also other optimizations were moving very slowly into PHP Runtimes. This might be due to the fact that PHP in contrast to Java restarts the VM after each request, which of course brings additional performance problems. For example for each request session data has to be read from disk. Although there are solutions in PHP (MemCache, APC) these are rarely and partly still heavily in development.
Interestingly, this drawback makes scaling of PHP applications fairly simple. As completely separate requests can be processed, additional hardware results in relatively linear improvements in the capacity of the server. On the Web, the focus is rather on the number of requests, not directly on the exact duration of an individual requests.
Choice
Ideally, you never will re-invent the wheel. It makes sense to look for already existing solutions. Both in PHP, as well as in Java, there is a lot of modular software, partly with free, partly with non-free licenses. However, PHP modules expose significantly more problems than those written in Java. For example, some PHP module developers invented own concepts (e.g. Zend Loader was created by Zend as a substitute for packages) or the modules are only optimized for a framework (like symfony plug-ins).
Java is, especially through the “complicated concepts” such as Class Loading and packages, better prepared for modularization. Due to better tool support (Ant / Maven, Javadoc, JUnit) Java Frameworks have easier to install, better documented and tested artifacts. However PHP tools for these tasks are also on the rise (pake / phing, PHPDocumentor, PHPUnit / lime).
Integration
Integration is certainly the strength of Java. On the one hand, Java itself is almost “Industry Standard”, on the other hand, there are many standards implementations in Java. If a PHP Web application should communicate with a specific protocol, the selection of libraries is rather limited. Even worse, implementations are either only partially implemented or very rudimentary (such as Zend OpenID). Integration of PHP applications with other services usually happens through the database layer.
Developer know-how
Even 20 years ago, Frederic Brooks searched for the “Silver Bullet” and did not find it. In his article he came to the conclusion that software design, problem formulation and the capabilities of the developers are far more important than tools or languages. Therefore, it is certainly a good idea to implement a website by a designer with knowledge of PHP with a state of the art PHP Framework. If it would be a Web front-end of a Java EE backend application Java would be the obvious choice.
However developer knowledge should not hide the fact that some technological hurdles can be overcome only with certain technologies or other languages. So consulting an expert with specific skills makes much more sense than to give it a try with inadequate tools.

So I conclude that Java is still the better choice for many projects. For smaller projects that can be isolated scripting languages might reach the target faster. As a compromise you might give Groovy Grails a try?
分享到:
评论

相关推荐

    Art of Java Web Development

    A guide to the topics required for state of the art Web development, this book covers wide-ranging topics, including a variety of web development frameworks and best practices. Beginning with coverage...

    image-comparison,发布在Maven Central Java库上,该库比较两个大小相同的图像,并通过绘制矩形直观地显示差异。图像的某些部分可以从比较中排除。可用于自动化质量保证测试。.zip

    《图像对比库image-comparison在Java中的应用与实践》 在软件开发中,尤其是在图形界面或者图像处理相关的项目中,确保图像的正确性和一致性是一项重要的任务。为了方便开发者进行这样的工作,一个名为“image-...

    comparison of nonlinear filter

    ### 非线性滤波器对比分析:扩展卡尔曼滤波器(EKF)、无迹卡尔曼滤波器(UKF)与粒子滤波器(PF) #### 概述 本文探讨了非线性滤波器在追踪再入大气层的弹道目标时的应用与性能比较。该研究聚焦于三个主要的非...

    A Comparison of Dictionary Implementations

    映射是一种将一个集合中的元素与另一个集合中的元素相对应的函数。例如,假设存在两个集合A和B,映射f:A→B表示将集合A中的元素a作为输入,并返回集合B中的某个元素b。映射有时也被称作字典,因为字典本质上就是将...

    comparison of db2 vs oracle

    ### DB2与Oracle数据库对比分析 #### 引言:为何选择IBM DB2? 随着全球数字化进程的加速,企业面临着前所未有的数据处理挑战。为了更好地利用信息技术(IT),许多组织正在寻求更智能、更高效的解决方案来应对日益...

    Comparison of the Coding Efficiency of Video Coding Standards

    视频编码标准的设计必须在两个主要领域之间取得平衡:一方面要为编码器和解码器的开发者提供尽可能多的自由度来自定义他们的实现,另一方面要确保不同厂商产品编码的视频信号能够可靠地被其他产品解码。这种自由度...

    Comparison of the Coding Efficiency of Video Coding Standard

    - **MPEG-4 Visual**:提供了更多灵活性和更高的压缩比,广泛应用于网络视频流传输等领域。 - **H.264/MPEG-4 AVC**:相比于前几代标准有显著改进,特别是在提高编码效率方面。H.264被广泛应用于网络视频传输、蓝光...

    Map of science with topic modeling Comparison of unsupervised

    Comparison of Unsupervised Learning and Human-Assigned Subject Classification"这篇文章探讨了如何通过主题建模来绘制科学领域的地图,并将这种方法与传统的人工分类方法进行对比。主题建模是一种无监督学习的...

    A Comparison of Affine Region Detectors University of Oxford论文

    本文是一篇由K. Mikolajczyk等来自不同研究机构的学者合作撰写的学术论文,旨在对仿射不变区域检测器(affine region detectors)进行评估和比较。论文的主要内容包括对六种不同的区域检测器在不同成像条件下的性能...

    A performance comparison of recent network simulators

    网络模拟作为一种广泛采用的方法论,在通信系统工程领域中占据着举足轻重的地位。它主要用于新型通信架构及网络协议的发展与评估。通过网络模拟器,研究者可以构建任意计算机网络模型,包括网络节点的行为以及通信...

    Java vs. Symbian: A Comparison of Software-based DSR

    ### Java与Symbian在软件基础分布式语音识别(DSR)中的对比 #### 摘要 随着现代移动电话处理能力的显著提升,分布式语音识别技术(Distributed Speech Recognition, DSR)的应用变得越来越合理。本文对两种最受...

    Java By Comparison - Become a Java Craftsman in 70 Examples

    本书《Java By Comparison - Become a Java Craftsman in 70 Examples》由Simon Harrer、Jörg Lenhard和Linus Dietz三位作者共同撰写,由Venkat Subramaniam作序,Andrea Stewart编辑。这本书的独特之处在于它通过...

    A Comparison and Evaluation of Multi-View Stereo Reconstruction Algorithms

    在本文中,我们旨在通过首次提供一系列高质量的、校准过的多视图立体图像及其与真实三维模型的配准,以及一种用于比较多视图算法的评价方法,来纠正这一不平衡。 本文的主要贡献包括:受[1]启发的一种多视图立体...

    Comparison of VHDL Verilog and SystemVerilog

    ### VHDL、Verilog与SystemVerilog的对比分析 #### 引言 随着硬件描述语言(HDL)的各种增强功能在过去几年中不断增多,选择最适合特定设计的语言也变得越来越复杂。许多设计师和组织正在考虑是否应该从一种HDL转向...

    Java (J2SE 5.0) and C# Comparison

    在编程世界中,Java(J2SE 5.0)和C#是两种非常重要的、广泛应用的编程语言。它们在很多方面都有相似之处,但也存在显著的差异。下面我们将详细对比这两种语言在程序结构、注释、数据类型、常量以及枚举等方面的特点...

    Comparison of Streaming Analytics Frameworks ppt

    流式分析框架对比演讲的标题“Comparison of Streaming Analytics Frameworks”暗示了其核心内容,即对不同大数据流处理框架与系统的比较研究。描述部分指出这些框架的优点和缺点被详细对比,而标签“streaming”指...

    Comparison of the three CPU schedulers in Xen

    例如,可以评估一个调度器如何更好地响应变化的应用程序需求、如何处理多核处理器的负载平衡,或者如何在VM之间有效地分配CPU资源。 在虚拟化环境中评估应用程序资源需求的挑战在于,传统的资源需求评估方法可能...

Global site tag (gtag.js) - Google Analytics