Comparison of perl, php, python, java and ruby

Source: Internet
Author: User
The development trend of the language must be the combination of dynamic and static data, the combination of strong and soft Perl, the concise and obscure Python, the elegant and clear Ruby, the concise and simple PHP, or the elegance of PHP, the preview of the details and specifications.

◆ The language development trend must be dynamic and dynamic combination and flexible.

◆ Perl is concise and obscure, Python is elegant and clear, Ruby is exquisite and smart, and PHP is concise and simple

◆ Perhaps elegance comes from the emphasis on details and specifications.

◆ (RoR) when combined with Ruby, it immediately sets off the figure of Java and. NET elephants as a ghost cat.

Question

◆ 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?

Explanations

"The remaining four dynamic languages are classified as background scripting languages ." The colon says and draws a chart --

"I remember you first divided these languages into three types: static language of the C family, static language of the non-C family, 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-the frontend language corresponds to the presentation layer, the platform language and the background scripting language correspond to the business logic layer, and the system language corresponds to the data layer ."

"It is indeed a bit like it, but it cannot be confused ." The colon reminds us that "the three-layer architecture is the logical division in the module design [1]; here is the physical division by language application scope-the frontend language is used to interact with users, and the system language is used to interact with machines, the background language is used to provide services for the front-end and underlying system services."

Ask by comma: "is the background language further subdivided into the platform language and background scripting language ?"

"This is based on the program and script, static and dynamic ." "In fact, Perl, PHP, Python, and Ruby both 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: "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 bonding 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 them and 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 have different influences than the latter ."

Exclamation point: "In the near future, dynamic language may become the main character ."

"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, static languages represented by Java and C # are grafted with the branches of dynamic languages; 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, similar to Jython, IronRuby, and IronPython. It is also worth mentioning that the most active stage of dynamic language is LAMP, L-A-M-P ."

Quotation marks: "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 ."

"It's 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 acronym text game, especially LAMP, which has the meaning of the LAMP. it implies a bright LAMP in the open source world, 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 features open, flexible, rapid development, convenient deployment, high configuration, security and reliability, and low cost. NET platform, especially popular with small and medium-sized enterprises. In LAMP, Linux is the operating system, Apache is the Web server, and MySQL is the database system. what we are most concerned about now is the 'p language ': PHP, Perl, Python, and Ruby ."

Question mark suggestion: "As dynamic languages, their commonalities have been discussed a lot in the previous lesson. can you tell me their personality ?"

"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 old brother Perl, which is widely used. it integrates the C language structure, sed regular expression, AWK's associated array (associative array), and Lisp's table (list) and Unix Shell commands, in addition to a language, do you know which?" The colon suddenly sold a token.

Comma conjecture: "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 ." The colon gave 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 it is not human, but I suspect it is ethereether-I feel dizzy after a while ."

Everyone laughed.

"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 a pair of sharp scissors to work on text cropping and other work. 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 strong adhesion, so there is a saying that 'Internet tape (duct tape) [2. 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 regarded as a powerful challenger to Perl, not only because of its natural OO design and rich class libraries, but more importantly, it is more friendly to programmers than Perl. Python also has a series of philosophies known as Zen, many of which are tit-for-tat 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, while Python has simple syntax and semantics, and rich class libraries. Perhaps the least annoying thing about Python is its sensitivity to margin characters ."

Surprised by the quotation marks: "Is it sensitive to blank spaces? This is really weird ."

The colon does not blame: "Although it is a bit 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, reducing 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: "How about Ruby? It is said that it will replace Java ."

"Do not replace the word ." According to the colon, "Java does not replace C ++, nor is it replaced by Ruby. at most, it is just a 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, weapons are more important than weapons. in elegant terms, programmers should be given more humanistic care. In terms of block and iterator, although Ruby is not the first, its syntax is the most pleasing to the eye. Similar examples are everywhere. Ruby's meta-programming capability is particularly strong and highly flexible, but not everyone likes this style. Ruby has two major weaknesses: one is similar to Python, and the other is to be improved in terms of performance; the other is that its thread is defined by the user space rather than the kernel space) to manage [3], cannot make full use of multi-core or multi-CPU. 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."

There are some doubts about the comma: "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 ."

"I think Perl, Python, and PHP must also have many frameworks. The Java frameworks are even more prevalent. how can they stand out from the unique RoR ?"

According to the colon analysis, "as the concept of web2.0 and agile development is prevalent, RoR combines AJAX and Ruby to form an excellent response. In the past, there were many web application frameworks, but there were not many lightweight packaged solutions before RoR. The Catalyst in Perl, Pylon in Python, and CakePHP in PHP should follow suit. Therefore, the timing of RoR is not too early or too late. 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 points are getting worried: "It's still dangerous to listen to this !"

"It's too early ." The colon does not agree. "First, RoR remains to be tested. Currently, no matter the application breadth or depth, it cannot be compared with Java. second, Java 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 while PHP processes socket streams ). 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 [4] are not supported. like Perl, the 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 in the first lesson 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 a language programming style. The deeper the understanding, the stronger the programming language sense, and the more the integration of thinking and language, the more difficult it is to move from the inevitable kingdom to the free kingdom ."

Comma is 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.

Plug-in

[1] There are two three-tier architectures: three-layer architecture and three-tier architecture. They are often used in different ways, but in fact there are differences: The former is only divided in logic, while the latter is also divided physically-modules of different levels run on different hosts.

[2] Many places have been translated as 'Conveyor belts 'and 'Conveyor belts. because duct has the meanings of 'conveyor Cano' and 'catheter', it is assumed that Perl plays a transport role on the internet. Unexpectedly, the 'duct type' refers to a universal adhesive tape used to compare the sticking force of Perl.

[3] Such threads are called green threads, also known as pseudo threads. Ruby2.0 is said to support native threads ).

[4] PHP will support namespace in 5.3.0 and unicode in 6.0.

Summary

◆ Compared with the Java platform and. NET platform, lightweight and flexible dynamic language, and high development efficiency, but the integration cohesion is not enough, 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 sensitivity to blank spaces.

◆ The Ruby syntax is exquisite and highly flexible. 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.