Comparison of Perl, PHP, Python, Java and Ruby

Source: Internet
Author: User
Tags ruby on rails

Preview

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

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

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

Full stop"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 ."Colon"The three-layer architecture (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."

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

"This is based on the Program and script, static and dynamic ."Colon"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 markI want to find out: "Is this because they are all dynamic languages ?"

ColonA: "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 pointSpeculation: "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. But one thing is certain,The Development Trend of language must be dynamic and dynamic combination and flexible."ColonAsserted,"On the one hand, static languages represented by Java and C # are grafted with the branches of dynamic languages; on the other hand, platforms represented by Java and. NET and dynamic languages are gradually expanding.. For example, jruby allows calls between Ruby and Java, similar to Jython, ironruby, and ironpython. It is also worth mentioning that,Dynamic Language is the most active stage when the number 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 ."

Colon"P can also be Perl, Python, or even Ruby ."

CommaRidicule: "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 ."ColonAs 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 markSuggestion: "As dynamic languages, their commonalities have been discussed a lot in the previous lesson. Can you tell me their personality ?"

"They have extremely distinctive personalities:Perl is concise and obscure, python is elegant and clear, Ruby is exquisite and smart, 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.

CommaConjecture: "It should be some 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 ."ColonAccording to the answer, "we mentioned that Larry Wall, the inventor of Perl, is a linguistics. He believes that programming languages should be as simple and natural as natural languages, 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 I have never heard of it, 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 ?"ColonQuandao said, "Perl's various magic symbols are like a pair of sharp scissors, which can be used to cut text 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, while Python emphasizes explicit, Perl emphasizes compact, and Python emphasizes loose;
Perl has rich syntax and semantics. Python has simple syntax and semantics, while class libraries are rich. Perhaps the least annoying thing about Python is its sensitivity to margin characters ."

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

ColonNot to 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 pointCurious: "How about Ruby? It is said that it will replace java ."

"Do not replace the word ."ColonAccording to the rule, "Java does not replace C ++, nor will it be 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 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
Instead of using the kernel space to manage [3], you 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."

CommaSome doubts: "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 ."

Full stopPuzzled: "I think Perl, Python, and PHP must also have many frameworks. The frameworks in Java are even more prevalent,How to stand out from the standalone ror?"

ColonAnalysis: "As the concept of Web and agile development emerges, 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 pointMore and more worried: "It's still dangerous to listen to this !"

"It's too early ."Colon"First, Ror remains to be further tested. Currently, it cannot be compared with Java in terms of application breadth or depth. 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 ."ColonA very simple answer: "unlike the general-purpose language defined in the beginning in Python and Ruby, PHP is designed for the Internet. 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, until PHP
5 is truly complete; there is not enough support for threads; compared with Perl, Python, and Ruby, its functions are slightly thin ."

Quotation marksSuddenly remembered: "I remember that you mentioned in the first lesson that PHP can still 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 ."

CommaFull 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 ."ColonHe deliberately wrote 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.

Original: http://levi.cg.am /? P = 711

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: 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.