Evaluation of several computer languages (revised edition)

Source: Internet
Author: User
Tags processing text

Novice programmers have a similar question: "What language should I study?" "。

The 14th chapter, "UNIX Programming Art" (Eric Raymond), evaluates various languages and can be used to answer this question. Here is my note, which collates the pros and cons of six major computer languages. After reading, you will know which language to choose for different tasks.

The original was written in 2003. Online Once there is an incomplete Chinese version, I also posted in this blog, so today posted only to calculate the revised version.

====================

Evaluation of several computer languages

Eric Raymond

From the Art of UNIX Programming (chapter 14th)

A, C

The advantage of C is that it runs efficiently and is close to the machine language. It is particularly suitable for the following programs:

1. Procedures that require a high speed of operation.

2. Programs that are closely related to the operating system kernel.

3. Programs that must be ported on multiple operating systems.

In addition, learning C has one of the biggest reasons, that is, it can help us to learn, at the hardware level to consider the problem. If you want to use programming as your life career, C must learn.

The biggest drawback of c is that during programming you have to spend a lot of time thinking about the very complex hardware resource management issues that are completely unrelated to the problem you're trying to solve.

Second, C + +

C + + was launched in the middle of the 80, supporting OO (object-oriented programming), originally intended as a replacement for the C language.

But it failed to do a bit, for the following reasons:

1. It also does not address the "memory management" issue, although it has improved compared to C.

2. Standardization is unsuccessful. Each compiler supports only a subset of its own choice, resulting in a cross-platform less than C.

3. Excessive refinement and complexity. C + + is more complex than the sum of C and OO complexity.

4. oo does not bring much advantage, but it brings some side effects, such as heavy gluing layers and large code volumes.

Overall, the advantages of C + + are program efficiency and object-oriented programming capabilities, and the bad thing is that it encourages complex designs.

Third, Shell

The shell program is easy to write, and for simple tasks, development is fast.

When the program gets bigger, it doesn't fit, it's hard to maintain, and it's going to be very dedicated (it's only available on your own machine), because the shell has to invoke various external programs, and there's no guarantee that each machine will have the same programs installed.

The most common shell is bash, and some of its grammatical rules are confusing, creating hard-to-read code. In addition, the shell can only be used on UNIX, not across platforms.

The best uses for the shell are as follows:

1. Perform simple system administration tasks.

2. Write the init script at system startup.

3. Wrappers for programs developed in other languages.

Iv. Perl

Perl, released in 1987, is basically an enhanced shell.

Its greatest strengths are strong text-processing capabilities, unmatched regular expression support, and internal support for a full set of UNIX APIs that significantly reduce the need for C.

The main disadvantage of Perl is that some parts are designed to be very ugly and irreparable, and some parts are too complex. When the program scale increases, must strictly abide by the Convention, can guarantee the modularization and the design controllability, is difficult to maintain.

V. Python

Python, published in 1991, is a scripting language tightly integrated with the C language.

Python has the advantage of being very clean and elegant, encouraging clear and easy-to-read code, easy to learn and easy to use, providing the possibility of object-oriented programming, but not imposing this choice on the designer, with excellent modularity, as in Java, for large, complex projects that require collaborative development. In many ways, it's simpler than Java. In addition, the Python standard includes support for many network protocols and is therefore well suited for network management tasks.

The disadvantages of Python are inefficient and slow. At execution speed, it is not only not competitive with C + +, but it is not as good as other major scripting languages. However, this is not really a serious problem, and sometimes the network or disk delay will completely offset the time that Python consumes. And because Python is particularly easy to combine with C, the performance-critical Python module can be easily translated into C to improve speed.

In general, Python is less expressive than Perl for small projects and large numbers of regular expression-dependent projects. For smaller projects, Python is overqualified, and the shell may be more appropriate.

VI. Java

Java was released in 1995 with two design goals.

One is "write once, Run Anywhere" (written once, running everywhere), that is, not dependent on a particular platform, and the other is to embed an interactive program (applet) in a Web page that can be run in any browser. Due to a series of mistakes by its owner, Sun, the first goal was not fully realized and the second goal was a complete failure. But Java is still very powerful in system programming and application programming, challenging C and C + +.

Java has the advantage of being smaller than C + +, it can automatically manage memory, support C-like syntax and OO programming, and the combination of C programs is also very good.

The disadvantage of Java is that some parts are too complex, such as the use of internal classes and anonymous classes can create confusing and confusing code, some parts of the function is not perfect, and can not take advantage of the operating system provided by the functional interface, such as reading and processing text files in Java, not as easy as other languages. In addition, the Java Configuration environment and version of the confusion, it is also a headache.

In general, Java is a better choice than C + + In addition to system programming and some programming that requires a high speed of operation. Java may have advantages over large projects, but not absolute, compared to Python.

Original address: http://www.ruanyifeng.com/blog/2010/03/programming_language_evaluations_revised.html

Evaluation of several computer languages (revised edition)

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.