Comparison of Perl, PHP, Python, Java, and Ruby]

Source: Internet
Author: User
From the content of this article, the writing time is relatively early, and some terms I think are not accurate, a bit colloquial, but it means. Q: What are the characteristics of Perl, Python, Ruby, and PHP? Why is dynamic language a lightweight solution? Why is LAMP popular? Why is RubyonRails popular? Development Trend of Programming Language

From the content of this article, the writing time is relatively early, and some terms I think are not accurate, a bit colloquial, but it means. Q: What are the characteristics of Perl, Python, Ruby, and PHP? Why is dynamic language a lightweight solution? Why is LAMP popular? Why is Ruby on Rails popular? Development Trend of Programming Language

From the content of this article, the writing time is relatively early, and some terms I think are not accurate, a bit colloquial, but it means.

Problem:

  • What are the characteristics of Perl, Python, Ruby, and PHP?

  • Why is dynamic language a lightweight solution?

  • Why is LAMP popular?

  • Why is Ruby on Rails popular?

  • What are the development trends of programming languages?

 

"The remaining four dynamic languages are classified as background scripting languages ." Said the colon and drew a chart --

"I remember you divided these languages into three types: static C language, static non-C language, and dynamic language ."

The colon explains: "It is divided by syntax, focusing on theory; now it is divided by application, focusing on practice ."

"This method looks like a three-tier architecture-frontend language corresponds to the presentation layer; platform language and background scripting language correspond to the business logic layer; system language corresponds to the data layer ."

"It seems a bit like it, but it cannot be confused ." The colon reminds us that "the three-tier architecture is the logical division of the module design, and here is the physical division based on the scope of the language application-the front-end language that interacts with the user, the system language is used to interact with machines. The background language is used to provide services for the front-end while the underlying system service is required."

Comma: "Is the background language subdivided into the platform language and background scripting language ?"

"This is based on programs and scripts, static and dynamic ." "In fact, Perl, PHP, Python, and Ruby all have their own virtual machines. In this sense, they can also be used as platform languages. But in practical applications, they do not have the integration cohesion and core functions of the Java and. NET platforms. They are usually used as lightweight solutions ."

Question mark, I want to find out: "Is this because they are all dynamic languages ?"

"Theoretically, dynamic languages can also undertake large-scale applications, but in practice they are mostly used as" glue "languages or for small and medium applications. It is a mainstream supporting role or a non-mainstream leading role for the time being. After all, there is a gap between Java and C # In terms of operation efficiency, type security, available resources, development tools, and technical support. In addition, they both belong to the 'grass-roots 'language. Despite the strong support of the open-source community, they cannot communicate with the latter in terms of influence ."

Exclamation point, speculation: "Maybe, in the near future, dynamic language will also become the mainstream ."

"The world is easy to move, and it is difficult to reverse the expected. However, it is certain that the development trend of the language must be dynamic and dynamic combination and flexible ." The colon asserted that "on the one hand, dynamic language branches are grafted in static languages represented by Java and C #; on the other hand, Java and. the interaction between platforms and dynamic languages represented by NET is also gradually expanding. For example, JRuby allows calls between Ruby and Java, and Jython, IronRuby, and IronPython. It is worth mentioning that the most active stage of Dynamic Language is LAMP, L-A-M-P ."

Quotes: "L is Linux, A is Apache, M is MySQL, and P is PHP. These four components form a complete open-source network development platform ."

"P can also be Perl, Python, or even Ruby," added the colon ."

Comma to ridicule: "It is a pity that Ruby's 'R' has a tail more than 'P ."

"Someone simply asked P to represent 'Programming language 'in order to justify itself. All these languages are covered here. Foreigners like to play this short character game, especially LAMP, which has the meaning of 'lamps. It implies that the Open Source world is a beacon and they must be more proud of it ." "As we mentioned earlier, network applications are the most fertile soil for Dynamic Language growth, and LAMP is the platform built on this soil. As a network platform, LAMP has advantages such as openness, flexibility, rapid development, convenient deployment, high configuration, security and reliability, and low cost. NET platform, especially welcomed by small and medium-sized enterprises. In LAMP, Linux is the operating system, Apache is the Web server, MySQL is the database system, and we are most concerned with the 'P language ': PHP, Perl, Python, and Ruby ."

Question mark, I suggest: "As dynamic languages, they have already talked a lot about their commonalities. Can you talk about their personalities ?"

"Their personality is extremely clear: Perl is concise and obscure, Python is elegant and clear, Ruby is exquisite and clever, and PHP is concise and simple. Let's take a look at the big brother Perl, which is widely used. It integrates the C language structure, sed regular expressions, AWK's associated array (associative array), and Lisp's table (list) and Unix Shell commands. In addition, it also draws on a language. Do you know which one is used?" The colon is suddenly sold.

Comma, I guess: "It should be an OOP language ."

"Perl does have many shadows of C ++, but its object model was introduced only after 5.0. The typical Half path is far less natural than the previous features. It is not so much a natural development as a kind of self-help catering to the OOP trend. It is natural language to learn more from bone marrow ." Colon, which gives the answer, "we mentioned that Larry Wall, the inventor of Perl, is a linguistics and he thinks that programming languages should be the same as natural languages, simple and natural, easy to read and write, diverse expressions, and eclectic. Perl also has a lot of sayings or philosophies, which make the programming language change its rigorous and rigid faces and create a strong humanistic atmosphere ."

Exclamation point: "I have seen Perl code, but the human breath does not smell it, but I suspect there is an ether breath-I feel dizzy after a while ."

Everyone laughs ......

"Someone has implemented the RSA Algorithm with only one line of Perl code. You can't faint on the spot after reading it ?" The colon joked, "Perl's various magic symbols are like sharp scissors, which can be used to cut texts. This is its biggest strength. Perl was originally used for Unix system management by Wall, which also benefited from its extensive application in CGI. This also gives Perl a strong adhesion, so there is a saying that 'Internet tape (duct tape. It is also known as Swiss Army knife, refined and complex, practical and powerful. However, Perl is too flexible and free, and lacks specifications, which affects the readability, consistency, purity, and maintainability of programs. Those who are not familiar with the language, such as reading tianshu, who are familiar with the language but not familiar with the problem, are also quite difficult to think about. In contrast, Python is considered a powerful challenger to Perl, not only in its natural OO design and rich class libraries, but more importantly, it is more friendly than Perl. Python also has a series of philosophies known as Zen, many of which are in comparison with Perl. For example, Perl thinks there are multiple ways to do one thing, while Python thinks there should be only one way to do one thing. Perl pursues language expressiveness and Python pursues simplicity and elegance; perl prefers implicit hint. Python emphasizes explicit expressions. Perl emphasizes compact and loose Python stresses. Perl has rich syntax and semantics. Python has simple syntax and semantics and rich class libraries. Perhaps the least annoying thing about Python is its sensitivity to margin characters ."

Surprised: "Is it sensitive to blank spaces? This is really weird ."

Colon: "Although a little against habits, it is very consistent with the standard and concise style of Python-on the one hand, it guarantees a good coding style in terms of syntax; on the other hand, each code block no longer needs the starting braces or begin/end, which reduces the number of lines of code. By the way, Haskell, another elegant language, is also sensitive to margin characters. Perhaps elegance comes from attention to details and norms. In addition, many people complain that there are too many self references in Python, but this is also a manifestation of its explicit expression. In general, the main problem with Python is still unsatisfactory in terms of performance efficiency ."

Exclamation point, curiously asked: "How about Ruby? It is said that it will replace Java ."

"Do not replace the word ." "Java does not replace C ++, nor will it be replaced by Ruby. At most, it is redistribution. However, Ruby is indeed a very cute language with both Perl performance and Python readability. The most distinctive concept behind Ruby is that it focuses on how programmers feel more than the language itself when using the language. In layman's terms, the weapons used to get started are more important than sharp weapons. In elegance, programmers should be given more humanistic care. In terms of block and iterator, although this is not Ruby's first, its syntax is the most pleasing to the eye. Ruby is particularly powerful in programming and highly flexible, but not everyone likes this style. Ruby has two main weaknesses: one is similar to Python, and the other is to be improved in terms of performance; the other is that its thread is made up of user space rather than kernel space) and cannot make full use of multiple cores or CPUs. The success of Ruby on Rails (RoR), the Web application framework, has also given rise to the Groovy language and the Groovy on Grails framework on the Java platform. RoR's CoC (Convention over Configuration) and DRY (Don't repeat yourself) Principles and MVC Architecture seem like nothing new, but with Ruby, as a ghost cat, Java and. NET."

Comma, some suspect: "The framework is so popular. Is the framework so important ?"

"If there are few dynamic pages in Web applications or the business logic is not complex, the value of the framework is not great. In the past, CGI programming embedded HTML code into code such as Perl, just like Servlet in Java. PHP simply inserts PHP code into HTML code, just like early JSP. No MVC, No matter what layer-3 architecture, no ORM. But -- "the colon has dragged on a turning point." Once the business logic becomes complex and the number of developers increases, hand-workshop-style programming begins to be stretched. Introducing the framework as a production line increases productivity is the trend of the times ."

The end is puzzled: "I think Perl, Python, and PHP must also have a lot of frameworks. Java's frameworks are even more prevalent. How can they stand out with a single RoR ?"

"When the concepts of Web 2.0 and agile development become popular, RoR combines AJAX and Ruby into an excellent response. In the past, there were many Web application frameworks, but there were not many lightweight packaged solutions before RoR. In Perl, the Catalyst, Pylon in Python, and CakePHP in PHP should follow suit. Therefore, the timing of RoR can be justified. In addition, because Perl and PHP are too popular, they have a lot of historical burdens. People are used to weaving the expression logic and business logic together. As for Java Enterprise Solutions, there are too many frameworks and more combinations, making selection more difficult. Even with the most common combination of lightweight SSH (Struts + Spring + Hibernate), it is much more complicated to maintain than RoR ."

Exclamation point, more and more worried: "listening to this, Java is still dangerous !"

"It's too early ." The colon does not agree. "First, RoR remains to be further tested. Currently, the application breadth and depth cannot be compared with Java. Second, Java still has many advantages in terms of performance and security, these are especially important for large and key applications. Even in Small and Medium-sized Web applications, RoR is far inferior to PHP ."

Question mark: Why is PHP so popular ?"

"Because it is simple and specific ." The colon gives a simple answer, "unlike the general language defined in Python and Ruby at the beginning, PHP is designed for the network. Similar to Perl in earlier versions, PHP initially played a major role in text filters, except that Perl processes file streams in multiple ways, while PHP processes socket streams in multiple ways. PHP has simple syntax and is tailored for network applications. It is reasonable to be sought after by network developers. Although it is very practical and popular, it is not perfect. For example, the variable name is case-sensitive, while the function name is case-insensitive. The function naming rules are inconsistent. The namespace and unicode are not supported. Like Perl, its object model is not inherent, it was not until PHP 5 was actually perfect; it lacked support for threads; compared with Perl, Python, and Ruby, its functions were slightly thin."

The quotation marks suddenly remind me: "I remember you mentioned before that PHP can also be used for desktop applications ."

"Not only PHP, Perl, Python, but also Ruby can be used as front-end languages to develop command line or graphical interface applications. Similarly, VB, Delphi, and JavaScript can also be used as background languages. Modern Programming Languages have their own expertise, but also develop towards generalization and comprehensiveness, in order to win more space for survival. Just imagine, why not modern programmers ?" As mentioned above, the colon has closed the topic. "There are still many interesting and useful languages, so I will not comment them here. We can see that each programming language has its own unique conventional usage and philosophical philosophy. Together with the programming paradigm, they form the programming style of the language. The deeper the understanding, the stronger the programming language sense, and the more integrated the thinking and language, the more difficult it is to move from the inevitable kingdom to the free kingdom ."

Comma, full of hope: "Is that a realm of unity of man and sword ?"

"Maybe the Integration of Human devices is more accurate. Programmers cannot only use one weapon ." The colon deliberately refers to his words. "Now everyone is invited to write a speech for this lesson ."

When everyone is thinking for a moment, they will just --

  • Exclamation point-there is no best language, but the most appropriate language.
  • Comma-no bad language, only bad programmers.
  • Question mark-no language is omnipotent. It is impossible to speak only one language.
  • Quotation marks-abolish the religious belief in language and establish Philosophical Thinking on language.
  • End-programming is the process of finding the optimal balance between the human brain and the computer.

When I read the big joy with a colon, I slapped a pair of sounds: "wonderful! It can be a combination of words, beads, and sentences. I decided to give you the reward: class now !"

Everyone enjoyed it.

Summary
  • Compared with the Java platform and. NET platform, lightweight and Flexible Dynamic Language, high development efficiency, but lack of integration cohesion, there are also some gaps in operation efficiency, type security, available resources, development tools, technical support, and influence. Therefore, it is usually used as a lightweight solution.
  • LAMP is a network development platform consisting of Linux, Apache, MySQL, and scripting languages including PHP, Perl, Python, and Ruby, it has the advantages of openness, flexibility, rapid development, convenient deployment, high configuration, security and reliability, and low cost.
  • Perl is refined, complex, powerful, flexible, free, concealed, and expressive. However, it is less standard, readable, consistent, neat, and maintainability.
  • Python is elegant and standardized, concise and clear, easy to learn and use, and has a wide variety of class libraries, but its efficiency is slightly poor. Some people do not like its blank character-sensitive features.
  • Ruby has exquisite syntax and high flexibility. It has both the performance of Perl and the readability of Python, especially the feelings of programmers. However, its performance and thread model still need to be improved.
  • PHP is simple, specific, practical, and popular. Compared with other three languages, PHP lacks syntax and functions.
  • RoR is a lightweight packaging web application solution. It is a good design (MVC Architecture and CoC, DRY principles) and a good language (Ruby) A good framework created at a good time (popular in Web2.0 and agile development.
  • Static and Dynamic languages are gradually integrated from language features to runtime environments.
  • Programmers should, like programming languages, have their own expertise and develop towards generalization and comprehensiveness.
  • The conventional usage, philosophy, and programming paradigm of programming language form the programming style of the language.

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: info-contact@alibabacloud.com 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.