Compare Perl, PHP, Python, Java, and Ruby

Source: Internet
Author: User
Tags php language ruby on rails

! Preview

· the development trend of language must be the combination of static and dynamic, flexible and economic

· Perl is obscure, Python is elegant and clear, Ruby is smart, and PHP is simple

· Perhaps elegance comes from the attention to detail and norms.

· RoR with Ruby, it's like a Nao with a cat, and instantly brings out Java and the. NET Elephant Figure

? Questions

    • What are the characteristics of Perl, Python, Ruby, and PHP?
    • Why is dynamic language more a lightweight solution?
    • Why is lamp popular?
    • Why is Ruby on rails popular?
    • What is the development trend of programming language?

: explanation

"There are four dynamic languages left, and we'll turn them into a background scripting language . "The colon said, drawing a chart--


front language :visual Basic,delphi, JavaScript

platform language :java ,c#

background scripting language :perl ,php,python,ruby

system language :c ,c++,d


The quotation marks listen carefully: "I remember you began to divide these languages into C-family static language, non-C-family static language and dynamic language three categories. ”

The colon explains: "That is divided by the grammar, the emphasis on theory, now is divided according to the application, emphasis on practice." ”

The period immediately reminds of: "This sort of method looks like three-layer architecture--the foreground language corresponds to the presentation layer; The platform language and background scripting language correspond to the business logic layer; The system language corresponds to the data layer. ”

"There is a sort of likeness, but must not be confused." The colon reminds, "the three-tier architecture (Three-layer architecture) is a logical division of the module design [1], and here is the physical division by the language application--the foreground language that interacts with the user, It is the system language that interacts with the machine , the background language in which the service of the front desk is provided and the underlying system service is required . "

Comma query: "Background language is subdivided into platform language and background scripting language?" ”

"This is based on program and script, static and dynamic." "The colon explains," actually Perl,php,python and Ruby have their own virtual machines, which in this sense can also be used as platform languages. But in real-world applications, they don't have the same cohesive and central role as the Java platform and the. NET platform, often as lightweight solutions. "

The question mark wants to find out: "Is it because they are all dynamic languages?" ”

The colon answers: "In theory dynamic languages can also assume large applications, but in practice they are more of an adhesive language or for small and medium-sized applications." With a fashionable words to describe, temporarily or mainstream supporting role or non-mainstream protagonist. after all, in terms of operational efficiency, type safety, available resources, development tools, technical support, and so on, they compared with Java, C #, there is still a certain gap. In addition, they are ' grassroots ' language, although the open source community's strong support, in the influence of the latter. ”

The exclamation mark speculated: "Perhaps in the near future, the dynamic language will also become the mainstream protagonist." ”

"The world is easy to move, it is difficult to unforeseeable." But one thing is certain, the development trend of language must be the combination of static and dynamic, flexible and economic. The colon asserts that, on the one hand, the branches of dynamic languages are grafted in static languages represented by Java and C #, while the platforms and dynamic languages represented by Java and. NET are gradually expanding. For example, JRuby allows Ruby and Java to call each other, like Jython, IronRuby, IronPython, and so on. It is also worth mentioning that dynamic language is the most active stage when the number of lamp,l-a-m-p. ”

Quote bite: "L is Linux,a is apache,m is Mysql,p is PHP. These four components form a complete open source network development platform. ”

The colon adds: "P also refers to Perl, Python, and even Ruby." ”

Comma joked: "Unfortunately Ruby's ' R ' has a tail more than ' P '." ”

"Someone in order to justify, simply let p say ' programming language ', this all languages are included in it." Foreigners like to play this acronym (acronym) of the word game, especially lamp just as there is a ' lamp ' meaning, meaning the open source world of a beacon, they must be more proud of. "The colon is kid," as we mentioned earlier, Web applications are the most fertile soil for growing dynamic languages, and lamp is the platform on which this soil is built. As a network platform, lamp is beauties with the Java platform and the. NET Platform for its open and flexible, rapid development, convenient deployment, high configurable, safe and reliable, low cost and so on, especially by small and medium-sized enterprises. In Lamp Linux is the operating system, Apache is a Web server, MySQL is a database system, and we are now most concerned about the ' P-family language ': PHP, Perl, Python and Ruby. ”

The question mark suggested: "As a dynamic language, their generality has been discussed a lot in the last lesson, can say their individuality?" ”

"They have a very distinct personality: Perl is obscure, Python is elegant, Ruby is smart, and PHP is simple . First look at Big Brother Perl, which borrows the length of the house, synthesizes the structure of the C language, the regular expressions of sed, awk's associative array (associative array), the Lisp Table (list), and the Unix shell commands, in addition to a language, Do you know what kind? The colon suddenly sold a xiaoguanzi.

Comma conjecture: "It should be some kind of oop language." ”

"Perl has a lot of C + + shadow, but its object model was introduced after 5.0, the typical halfway decent, far less natural than the previous features." It is not so much a natural development as a kind of involuntary pandering under the trend of OOP. The true depth of bone marrow is borrowed from natural language. "The colon gives the answer," we mention that the inventor of Perl, Larry Wall, is a linguist who believes that programming languages should be as simple and natural as natural language, easy to read and write, expressive and eclectic. Perl also has a lot of maxims or philosophy, so that the programming language to change the rigorous stereotypes of the face, emitting a rich cultural atmosphere. ”

A silent exclamation: "I have seen Perl code, the humanities breath did not smell out, but I suspect that there is a smell of ether--look at a while I feel dizzy." ”

The crowd laughed.

"Someone just use a line of Perl code to implement the RSA algorithm, you see that still not faint on the spot ah?" The colon quipped, "Perl's various magic characters are like a pair of sharp scissors, do the work of text clipping and so on. This is its biggest advantage, originally Perl is wall used to do UNIX system management, later on CGI's extensive application also benefited from this. This also gives Perl a very strong adhesion, so there's a ' tape on the Internet (Duct tape) [2] ' saying. It is also known as the Swiss Army knife, concise and complex, practical and powerful. But Perl is too flexible, free, and lacks norms that affect the readability, consistency, cleanliness and maintainability of the program. is not familiar with the language is such as reading the heavenly book, familiar with the language and not familiar with the problem is also quite a consideration. Python, by contrast, is considered a powerful challenger to Perl, not only for its natural OO design and its rich library of classes, but more importantly for its programmer-friendliness over Perl. Python also has a series of philosophies called Zen (Zen), many of which are diametrically opposed to Perl. For example, Perl thinks that doing one thing can be done in many ways, and Python thinks that one thing should be the best way; Perl pursues the expressive force of language, Python pursues simple elegance; Perl prefers implicit hints, Python emphasizes explicit, and Perl emphasizes compactness, Python emphasizes loosely, Perl's syntax and semantics are rich, Python's syntax and semantics are simple and the class library is rich. Perhaps the most unaccustomed thing to Python is its sensitivity to whitespace characters. ”

Quotation marks: "Sensitive to white space characters?" This is really weird. ”

The colon is not accustomed to: "Although a bit of a violation of the habit, but very consistent with Python's consistent standard of concise style-on the one hand, the syntax to ensure a good coding style; On the other hand, each block of code no longer requires a starting brace or begin/end, and so on, reducing the number of lines of code. By the way, another elegant language Haskell is also sensitive to whitespace, perhaps elegance comes from the attention to detail and norms. In addition, many people complain that the self-reference in Python is too much, but it is also a manifestation of its advocacy of explicit expression. In general, the main problem with Python is not as satisfactory in performance efficiency. ”

Exclamation mark curiously asked: "How about Ruby?" It is said to replace Java. ”

"Don't say ' replace ' the word. "The colon precepts," Java does not replace C + +, and it is not replaced by Ruby, at most just a redistribution. But Ruby is really a lovely language, with both the expressiveness of Perl and the readability of Python. The most distinctive idea behind Ruby is that it's more about how the programmer feels about language than the language itself. In layman's words, the hand of the weapon is more important than the sharpness, and the programmer should be given more humane care. In the case of blocks and iterators (iterator), they are not the first in Ruby, but their syntax is the most pleasing. Similar examples abound. Ruby's meta-programming ability is particularly strong, and it is a highly flexible embodiment, but not everyone likes this style. Ruby has two main weaknesses: one that is similar to Python and has yet to be improved in performance, and the other is that its threads are managed [3] by user space rather than kernel space (kernel spaces), and cannot take full advantage of multicore or multi-CPU. What really makes Ruby hot is the success of the Web application Framework Ruby on Rails (RoR), which also spawned the groovy language on the Java platform and the groovy on grails framework. Ror's COC (Convention over Configuration) and dry (Don ' t repeat yourself) principles and the MVC architecture seem to be nothing new, but when combined with Ruby, it's like only nao the body and the Civet, Instantly bring out Java and. NET elephant figure. "

Comma some doubt: "The framework is a red language, the framework is really so important?" ”

"If there are fewer dynamic pages in the Web app or the business logic is not complex, the framework is not worth much." In the past, CGI programming was to embed HTML code in code such as Perl, as servlet;php in Java simply inserted PHP code into the HTML code, like an earlier JSP. No MVC, no three-tier architecture, no ORM. But--"the colon drags a jog," once the business logic becomes complex, the number of developers, manual workshop programming began to be stretched, the introduction of the framework of the production line to improve productivity is the trend. ”

Period puzzled: "I think Perl, Python and PHP must have a lot of frameworks, Java framework is overrun, why alone Ror stand out?" ”

The colon makes an analysis: "When the concept of web2.0 and agile Development is popular, ROR combines Ajax with Ruby to be a great response." There were a lot of previous Web application frameworks, but there were not many lightweight package solutions before Ror. The catalyst in Perl, the pylon in Python, and cakephp in PHP should be emulated. So the time for Ror to appear is not too early, just as it is. In addition, Perl and PHP are too popular, but there are a lot of historical baggage, people are accustomed to the expression of logic and business logic to weave together. As for the Java Enterprise Solution, there are too many frameworks, more combinations and more difficulty in choosing. Even with the most common lightweight ssh (struts+spring+hibernate) combination, it is much more cumbersome to maintain than ROR. ”

The exclamation point is increasingly worrying: "Listen to this, Java is still dangerous!" ”

"It's too early to say. "The colon does not agree," first Ror still need to be further tested, at present, regardless of the breadth of application or depth can not be compared with Java, followed by Java in performance, security and other aspects of the advantages, and these for large and critical applications are particularly important. Even in small to medium-sized Web applications, ROR is far less than PHP. ”

Question mark next topic: "Why is PHP so popular?" ”

"Because it's simple, single-minded. "The colon is a very straightforward one," unlike Python and Ruby, which initially targeted the common language, PHP is built for the web. Similar to earlier Perl, PHP initially primarily acts as a text filter, except that Perl handles the file stream more, and the PHP multi-processor socket stream (socket stream). PHP's syntax is simple, and for the network application of the tailor-made, by the network developers are sought after when it is understandable. Although it is very practical and popular, it is not perfect. For example: variable name case sensitive and function name case insensitive; The naming rules of functions are inconsistent; namespace and unicode[4]; like Perl, its object model is not innate until PHP 5 is really perfect; not enough support for threading; Python and Ruby, it's a little bit thin, and so on. ”

The quotation marks suddenly reminds me: "I remember you mentioned in the first lesson that PHP can also be used for desktop applications." ”

"Not only Php,perl, Python and Ruby can be used as the foreground language to develop command line or graphical interface applications. In the same way, VB, Delphi, and JavaScript can be used as background languages. Modern programming language has its own expertise, but also to the general and omnipotent development, in order to win more space for survival. Imagine that modern programmers are not so? "In this case, the colon closed the topic," The language review is over, there are a lot of interesting and useful language, here is not a comment. We see that each programming language has its own customary usages and philosophical philosophies, which together with the programming paradigm form the language's programming style. The deeper the understanding of the more programming sense of language, thinking and language blend without hindrance, gradually from realm toward realm. ”

The comma is full of longing: "Is that a human sword unity of the realm?" ”

"Perhaps the unity of the human device is more accurate, the programmer can not only a weapon yo." "The colon deliberately plucked at his words," Now please everyone write a sentence of this lesson of the speech. ”

The people meditate for a moment, Qi Qi swipes and then--

Exclamation mark--there is no best language, only the most appropriate language.

Comma--no bad language, only bad programmers.

Question mark--no language is omnipotent, only one language is absolutely impossible.

Quotation marks--abolishing the religious belief of language and establishing philosophical thinking of language.

Period-programming is the process of finding the best balance between the brain and the computer.

The colon read the big Yue, the hand clap a palm five horse fart: "Wonderful!" It is a abas, a sentence of the United Choi Ah. It is decided that the reward for all of you is--class now! ”

The crowd was glad to receive the reward.

, Insert Language

[1] There are two three-layer architectures, one is Three-layer architecture, and the other is Three-tier architecture. They are often swapped, but there are differences: the former only divides logic, while the latter is physically divided-different levels of modules run on different hosts. [2] Many local translation ' conveyor belt ', ' conveyor belt ', because the duct have ' duct ', ' conduit ' meaning, then think of course that this shows that Perl on the Internet to play a role. But ' duct type ' refers to a versatile sticky tape that is used to describe the adhesion of Perl. [3] Such threads are called green threads, also known as pseudo-threads. It is alleged that Ruby2.0 will support native threads (native thread). [4] PHP will support namespace in 5.3.0, which will support Unicode in 6.0.

. Summary

    • Compared to the Java platform and the. NET platform, dynamic language is lightweight and flexible, development efficiency is high, but the integration of cohesion is not enough, in terms of operational efficiency, type security, available resources, development tools, technical support and impact of a certain gap, it is often used as a lightweight solution.
    • Lamp is a network development platform consisting of Linux, Apache, MySQL and scripting language including PHP, Perl, Python or Ruby, which has the advantages of openness, agility, rapid development, easy deployment, high configuration, safety and reliability, and low cost.
    • Perl is concise, complex, powerful, flexible, free, obscure, expressive, but normative, readability, consistency, cleanliness and maintainability is poor.
    • Python is elegant, concise, easy to learn and easy to use, class library rich, but less efficient, some people do not like its white space character sensitivity.
    • Ruby's syntax is sophisticated, highly flexible, with both Perl expressiveness and Python readability, with particular emphasis on the programmer's feelings, but its performance and threading model has yet to be improved.
    • PHP is simple, single-minded, practical, popular, but in comparison with the other three languages, there is a slight lack of syntax and functionality.
    • Ror is a lightweight, package-style Web application solution that is a good framework for good design (MVC architecture and COC, dry principles) plus good language (Ruby) at a good time (web2.0 and agile development).
    • Static and dynamic languages are converging from language features to operational environments.
    • Programmers should be like the programming language, with their own expertise, but also to the general and universal development.
    • Programming language usages, philosophical concepts and programming paradigms form the language's programming style.

Finally, what is the problem, you can give me a message oh, don't forget to follow my blog OH:


This entry was posted in the PHP catalog, labeled Java, Perl, PHP, Python, and Ruby. Add a pinned link to your Favorites folder.← App Store address and source code for 23 open source appsyunfile–50g free network hard drive with the capacity to make money→

        1. Pingback: Sife»[perl] Compare Perl, PHP, Python, Java, and ruby-

        2. Comparison of Pingback:perl, PHP, Python, Java, and Ruby @ leo108 ' s blog

        3. Pingback: Drip-dig technical details»[python] Compare Perl, PHP, Python, Java, and ruby-

        4. What is the biggest difference between pingback:php language and other programming languages?? – Technical FAQs | South Dragon's Station

        5. hard men and women on November 16, 2012 at 12:42 said:


        6. Pingback:web programming language selection: Compare Perl, PHP, Python, Java, and Ruby | Stewed in a mess | Error404-it Learner Log


Compare Perl, PHP, Python, Java, and Ruby

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.