PHP 是不是被 Ruby on Rails 带上了邪路?
很早以前就想说说这个问题,在知乎里忍了很久,看了很多大神们的文字,终于忍不住把它提出来。。。
背景大家都知道,不多说了,开始是Ruby on Rails挑战PHP,现在几乎各种大点的PHP框架都在一个劲模仿Ruby on Rails。。。最厉害的就是CakePHP了。
然而很多制作大型框架的大神们貌似都忘记了PHP简单易用的本质,PHP不是Java,把一些东西封装得太厉害,感觉是弄巧成拙!
(字数限制,未完待续!)
回复内容:
php 开发团队缺少一位象DHH那样有想法的领袖。从5开始逐渐偏向java,看来php核心团队对“PHP不适合企业级开发”耿耿于怀。简单易用、适合新手的特性也逐渐丢弃。流行的php框架也都没有自己的设计思想,要么学spring,要么django,更多的是学rails,说到底,php并没有出现优秀的框架。说php被rails带上邪路我不太赞同,rails之所以优秀,得益于dhh提出的一些设计思想,比如dry,比如约定优先于配置。还有大量的最佳实践。php框架应该学习的是他的思想,而不是表面的东西。应该说是开发者被那些五花八门框架带上了邪路, Rails是刺激了PHP,
也有一半部分原CakePHP开发人员感觉是CakePHP不是很符合PHP,所以重开了一个Lithium PHP框架,
比起Zend,Symfony这些(个人觉得zend有太重的Java味道, 至于Symfony的函数名是不是obj-c味,CakePHP是不是rails味,Yii是不是.net味倒是不清楚了)“大型” 框架,Li3很不错 框架跟语言两码事,嫌邪就不用框架呗 (字数限制,上接问题)
拿官方的Zend Framework来说,我感觉它更像一个啥代码生成器,好多故弄玄虚的东西。用Zend Framework的时候,我感觉不是在编写一个网站而是感觉在用Java或是C#编写一个软件。完全没有PHP那种感觉。比起Zend Framework,Symfony做得有过之而无不及。就像Android在Linux上面自己做一个层一样,这些框架貌似想在PHP基础上自己再搞个层出来。PHP本来是一种非常高级的语言,这些框架却有把它变成底层语言的意思。
所以我更喜欢使用一些更轻量级的东西,比如ThinkPHP、CodeIgniter之类的东西。。。
-------------------
我承认PHP不太适合大型项目,大型项目你用Java啊!何必勉强PHP呢?听说Twitter不是也考虑放弃Ruby on Rails而改用Java了么。。。
希望听听大家的语言。。。 它可能受惊了
之前大学的时候玩过php,一开始工作用java,然后创业用rails。自己本身各种语言都玩。玩过这么多语言,觉得还是算比较全面的分析一下:
欢迎拍砖。
- 严谨性。 很难写出没有bug的代码,PHP本身是一门hack语言,各种打补丁的方式来扩展自己。
- 生态圈 。 php社区的投资或者积累都在web这块。PHP非常适合变化很快的web产品的开发。> ( @Allen )本身的优势就在于生成页面。但是在于事务,数学计算,安全等领域,PHP的积累都不足以支撑其在企业领域的应用。 php 开发团队缺少一位象DHH那样有想法的领袖。rails各种web的最佳实践(pjax,scss,coffee)甩开php几条街
- 应用场景 php更多的是前端,在后端,桌面端,移动端基本上没有任何的市场。
- 与其他平台系统的 互操作性(web service) 。企业老的系统通过webservice 进行交互,java,.net 都有成熟的解决方案。
- 版本演进。 php6一而再再而三被延迟发布。
- 语言被创造时候的基因。 >(php -- 超文本预处理器的字母缩写)(感谢@张画虫),显然主要是为了网页而生,当然这个历史很久了,不过从历史可以看出某些语言设计的初衷,而这些都会成为语言的基因,会随着语言的发展一直继承下来
- 维护成本
因为蕴含了太多的hack,太多的全局函数,魔术变量,各种不统一,维护成本非常高
php语言本身的特性不足一支撑一个框架所要表达的思想,导致的结果就是各种框架满天飞,质量参差不齐。
> ( 借用 @王小一 的话 )拿官方的Zend Framework来说,我感觉它更像一个啥代码生成器,好多故弄玄虚的东西。用Zend Framework的时候,我感觉不是在编写一个网站而是感觉在用Java或是C#编写一个软件。完全没有PHP那种感觉。比起Zend Framework,Symfony做得有过之而无不及。就像Android在Linux上面自己做一个层一样,这些框架貌似想在PHP基础上自己再搞个层出来。PHP本来是一种非常高级的语言,这些框架却有把它变成底层语言的意思。
至于php的优势就是成熟web产品,各种cms,还是很有价值的,比如wordpress。
用框架写运用确实太方便不喜欢框架可以不用啊 PHP简单易用,恐怕是很早以前的说法了。对一个PHP新手来说,如果不借助一个框架,写一个可靠的应用是很困难的。

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

AI Hentai Generator
Generate AI Hentai for free.

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

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

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

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

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

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.

Java Made Simple: A Beginner's Guide to Programming Power Introduction Java is a powerful programming language used in everything from mobile applications to enterprise-level systems. For beginners, Java's syntax is simple and easy to understand, making it an ideal choice for learning programming. Basic Syntax Java uses a class-based object-oriented programming paradigm. Classes are templates that organize related data and behavior together. Here is a simple Java class example: publicclassPerson{privateStringname;privateintage;

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
