Table of Contents
PHP.vs.JAVA,php7vsjava
Home php教程 php手册 PHP.vs.JAVA,php7vsjava

PHP.vs.JAVA,php7vsjava

Jun 13, 2016 am 08:40 AM
java php

PHP.vs.JAVA,php7vsjava

现在市场上的OA基本上可归结为两大阵营,即php阵营和java阵营。但对接触Oa不久的用户来说,看到的往往只是它们的表相,只是明显的价格差异,却很难看出它们之间的实际差异。其实, PHP + MYSQL 不值钱不仅仅局限于oa软件,而是整体上PHP + MYSQL开发的软件都不如java开发的软件值钱。为什么PHP + MYSQL 的OA为什么不值钱呢?首先得明白php和java之间的差异才行。 

  1、系统的技术架构比较 

  分层是将系统进行有效组织的方式,分而治之的思想是计算机领域中非常重要的思想。在好的分层思想引导下,便能实现“高内聚、低耦合”,也能将具体的问题割裂开来,易于控制、易于延展,更易于分配资源。PHP只能实现简单的分布式两层或三层的架构,而JAVA在这方面就十分强大,可以实现多层的网络架构。运用MVC的设计模式,可使oa系统具有更加高效、合理的系统架构。技术架构的落后,使运用php编写的oa软件系统先天不足,而后天又无法补足其先天上的劣势。使得系统在可拓展性、需求应变性上与JAVA编写的oa软件系统的差距越来越大。架构的差距,注定了php做的oa充其量是个小家碧玉,始终无法和java这种大家闺秀同台竞技。 

 2、数据库访问比较 

  PHP可编译成具有与许多数据库相连接的函数。将自己编写外围的函数去间接存取数据库。通过这样的途径当更换使用的数据库时,可以轻松地修改编码以适应这样的变化。但PHP提供的数据库接口支持彼此不统一,比如对Oracle, MySQL,Sybase的接口,彼此都不一样。由于PHP对于不同的数据库采用不同的数据库访问接口,所以数据库访问代码的通用性不强。 

  而Java通过JDBC来访问数据库,通过不同的数据库厂商提供的数据库驱动方便地访问数据库,访问数据库的接口比较统一。如果同样是将开发的web应用从MYSQL数据数转到ORACLE数据,PHP需要做大量的修改工作,而且比较繁琐。但JAVA开发的便只需要很少的更改便能实现。 

  数据库访问方式的差异,奠定了php开发出的oa和java开发出来的oa是马车和火车的差距,前者只能亦步亦趋而且额度有限,后者却是工业化的结晶,不仅能够包容万物而且速度上稳步提升。 

  3、安全性对比 

  在同是开源和跨平台的java面前,php丢掉了很多的优势。在代码的安全性上尤为突出。php的开发程序在别人拿到代码后,可以很容易的进行修改。而java开发的程序由于无法看到完整的源代码,只能看到一些编译好的类文件,所以安全性较高。加之系统架构的优势,在安全性上php和java是相去甚远。 

  如果非要将php和java在安全性上做个比较的话,同一个小偷光顾php那是随便拿来随便改,想拿什么拿什么,拿的高兴还能大笔一辉某某到此一游。而光顾java的时候,便会发现警察把守,内设自动报警装置,即便突破重重阻扰后进入居室。那值钱的东西都放在加密后的保险柜中,只能望洋兴叹、铩羽而归。 

  4、前瞻性和拓展性 

  从整体来说,php适用于中小型系统,而java适用于大型系统。Php能够将单一的事件做好,但却不适合完成集成度较高的多项并发事件。为什么说php适合中小型系统而不适合做大系统呢? 

  首先, php缺乏多层结构支持。而对于大型的系统负荷站点,只能采用分布计算。将数据库、应用逻辑层和表示逻辑层彼此分开,并将同层的根据流量分开,组成二维数组。而php恰恰缺乏这种支持。 

  其次,PHP提供的数据库接口不统一,要将多个不同的数据库数据统一需要花费很大的力气。而JAVA则没有这种缺陷,可通过SUN Java的Java Class和EJB获得规模支持,通过EJB/CORBA以及众多厂商的Application Server获得结构支持。如IBM的E-business,它的核心是采用JSP/Servlet的Web Sphere,是通过CGI来提供支持的。 

  如果将Php比作将才,具备独挡一方的能力。那么java便是帅才,具有较好的前瞻性和拓展性,整体布局和协同能力强。能够指挥千军万马,最后逐鹿中原。 

  5、开发成本比较 

  既然php在诸多方面都不如java优异,那么php开发出的oa产品何以与java产品竞争呢?在于Php阵营普遍走的是低端路线,而java阵营走的是中高端路线。两者之间交叉的区域较小。 

  软件价格的高低很大程度上和自身成本和功能相挂钩。php的入门门槛较低,绝大多数学过c的程序员都很容易转型为php程序员,这使得php程序员的泛滥成灾的同时,低成本的php软件产品也层出不穷。以PHP最经典的组合PHP + MySQL + Apache为例,由于所有软件都是开源免费的,所以投入并不高。 

 而java开发需要特定的环境,成长为一个合格的java程序员需要一定的时间,java程序员的成本也是php成本的几倍。Java的web应用服务器免费的有Tomcat、JBoss等,而要想具有很好的商业化服务便必须选用Web Sphere和 Web logic。这其中投入的成本无形中便超是php成本的N倍。所以,java开发oa的成本要远远高于php开发出来的同类软件产品。但也正由于java开发的成本较高,很难实现抄袭和短期内逾越的可能,也使得java用开发出的产品门槛更高。 

  不怕不识货,就怕货比货。Php开发出来的产品也能用,但是和java开出的同类产品是没法比较的。正因为php开发的产品整体性能和java开发的相去甚远,所以php运用低成本的低价优势和同类的java产品抗争,以价格落差来平衡购买者的心态。所以,PHP + MYSQL 的OA不值钱也就不足为怪了

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

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

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

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

Break or return from Java 8 stream forEach? Break or return from Java 8 stream forEach? Feb 07, 2025 pm 12:09 PM

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

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

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.

Create the Future: Java Programming for Absolute Beginners Create the Future: Java Programming for Absolute Beginners Oct 13, 2024 pm 01:32 PM

Java is a popular programming language that can be learned by both beginners and experienced developers. This tutorial starts with basic concepts and progresses through advanced topics. After installing the Java Development Kit, you can practice programming by creating a simple "Hello, World!" program. After you understand the code, use the command prompt to compile and run the program, and "Hello, World!" will be output on the console. Learning Java starts your programming journey, and as your mastery deepens, you can create more complex applications.

See all articles