Eric Raymond's comment on several major development languages

Source: Internet
Author: User

A few years ago, if you were on a technology forum, you could easily fall into a battle for programming languages. In the past few years, it may have been a bit of a quarrel, but it has gone to another extreme. We cannot tolerate a little bit of language debate and comparison. Most of the time, people will jump out and say that the language is not competitive, and the argument is meaningless. In fact, there are two different languages. Speaking in natural language, like English and Chinese, English is much more accurate in terms of wording than Chinese. Therefore, when writing a thesis, it is often more accurate in English. In programming languages, C is longer than the performance. Python focuses on bonding. If you compare them carefully, they have advantages and disadvantages. However, there is no absolute superiority, but such comparisons must be placed in a specific environment. Such comparisons are meaningful and valuable.

Speaking of this, we can't stop talking about mixed programming. A few years ago, the cool people in my mind were the ones who were able to get familiar with the c ++ standard and put the C ++ syntax into play, learning C ++ (or Java) is not afraid to go all over the world. But now, the situation has changed. It is no longer a situation where one or two languages are unified throughout the world. The popular practice is to use each language to process what it is best at, and then bond these modules. As I mentioned at the beginning of the original article, "mixing versions is a knowledge-intensive (rather than coding-intensive)
Style of programming. To make it work, you have to have both
Working knowledge of a suitable variety of ages and expertise
About what they're best at and how to fit them together.
Hybrid programming will be the trend in the future.

 

Original article address (in fact, it is a chapter in the art of Unix programming ):

Http://www.catb.org /~ ESR/writings/taoup/html/ch14s04.html # c_language

Translation address:

Http://blog.csdn.net/myan/archive/2003/05/15/1923.aspx

 

C


Although the C language has serious defects in memory management, it is still dominant in some application fields. C is still a good choice for programs that require the highest efficiency, good real-time performance, or are closely related to the operating system kernel.

C's good portability also adds points for it. However, the portability of many other languages is getting better and better, and C's advantages in this area may gradually be lost.

Many existing programs can generate very good C code, such as syntax analyzer and GUI builder. At this time, the C language is also attractive, because the code you need to write is only a small part of the entire program.

Furthermore, we should certainly understand that C language has irreplaceable value for programmers. As for every language I discuss here, as long as you discover it deep enough, you will see that their kernels are written in pure and portable C.

At this time, we 'd better regard C as an advanced assembly language on a Unix virtual machine.

Even other advanced languages can fully meet your work needs. It is still helpful to take the time to learn the C language. It can help you think about problems at the level of the hardware system.

Even today, the best C language tutorial is the K & R Second edition of the C programming language published in 1988.

Conclusion: The best part of C is its efficiency and closeness to machines, and its worst part is its memory management.

C ++


C ++ was initially released in the middle of the 1980 s. At that time, object-oriented language was considered a silver bullet to solve software complexity issues. C ++'s object-oriented feature fully surpasses C, and supporters believe C ++ will quickly squeeze the previous generation of languages into the showroom.

But this is not the case in history. At least part of the reason lies in C ++ itself. To be compatible with C, C ++ was forced to make many major design compromises. As a result, the language was too gorgeous and too complex. To be compatible with C, C ++ does not adopt an automatic memory management policy, thus losing the chance to correct C's most serious problem.

In addition, I am afraid it should be regarded as object-oriented. It seems that OO has not met people's expectations for the year. I have investigated this problem and found that using the OO method causes a lot of problems between components.
Thick bonding layer brings serious maintainability problems. Today, let's take a look at the open source code community. You will find that C ++ applications are concentrated on GUI, game, and multimedia toolkit.
It is rarely used. You know, object-oriented has proved very successful in these fields. The choice of the open source community largely reflects the free will of programmers, rather than the random manipulation of the company's management.
Swing.

Maybe there is a problem with the c ++ method for implementing oo. There is evidence that the overhead of the C ++ program throughout the lifecycle is higher than the corresponding C, Fortran and Ada programs. However, it is not clear whether this should be attributed to the oo implementation of c ++.

In recent years, C ++ has joined many non-oo ideas, and its abnormal ideas are similar to lisp. The emergence of STL is remarkable.

In fact, the most fundamental problem with C ++ is that it is basically just another traditional language. Memory Management in STL is much better than the previous new/delete and C solutions, but it still does not solve the problem. For many applications, its oo feature is not obvious. Compared with C, it does not gain many benefits except for increasing complexity.

Summary: The advantage of C ++ is that, as a compilation language, it combines efficiency with generics and object-oriented features. Its disadvantage is that it is too gorgeous and complicated and tends to encourage overly complicated design.

Java


Java design is very clever. It uses automatic memory management, which is the biggest improvement. Although the benefits of supporting OO design are not so prominent, it is also very commendable. Compared with C ++, its OO design is small and simple.

Compared with python, Java has some obvious mistakes. In some cases, the design is still too complex, or even flawed. Java class visibility and implicit scoping rules are too complex
. The interface mechanism is designed to avoid problems caused by multi-inheritance, but it is still difficult to understand and use it. Internal and anonymous classes lead to confusing code. Lack of effective analysis mechanisms,
It makes it difficult to manage other resources (such as mutex and lock) except memory. Java threads are not reliable, and its I/O mechanism is very powerful, but reading a text file is very cumbersome.

Java does not have a mechanism to manage the library version, and thus forms the same as windows DLL. In an environment similar to an application server, this causes a lot of problems.

In general, apart from System Programming and highly efficient programs, Java is superior to C ++ in most fields. Experience shows that Java programmers seem to be less likely to construct excessive oo layers like C ++ programmers, but this is still a serious problem in Java.

Is Java better than Perl,
A language like python? We are not very clear, and it seems to be related to the program scale to a large extent. Its fields of expertise are basically similar to those of Python, which cannot be compared with C/C ++ in terms of efficiency,
Perl cannot be matched in small-scale projects that use pattern matching and editing in large quantities. In small projects, Java seems too powerful. We guess python is more suitable for small projects, while Java
Integration with large projects, but this is not proven.

Python


Python is a scripting language that can be closely integrated with C. It can exchange data with the Dynamically Loaded C library module or call from C as an embedded scripting language. Its syntax is similar to the combination of C and modular languages. However, it has a unique feature, that is, to determine the statement block by indentation.

The Python language is very clean, elegant in design, and has excellent modular features. It provides object-oriented capabilities, but does not force users to design objects. Its type system provides powerful Expressiveness
Li, like Perl, has an anonymous Lambda expression, which makes lisp hackers feel friendly. Python relies on TK to provide convenient GUI development capabilities.

Among all interpreted languages, Python and Java are best suited for multiple programmers to develop large projects collaboratively in a gradual manner. In many aspects, python is simpler than Java, and it is very suitable for building a rapid prototype, which gives it a unique advantage for Java: for those that are neither complex, python is suitable for programs that do not require high efficiency.

The speed of Python cannot be compared with that of C/C ++. However, in today's high-speed CPU, the rational use of mixed-language programming strategies can effectively compensate for the above weaknesses of Python. Fact
Python is considered to be the slowest of mainstream scripting languages because it provides dynamic polymorphism. In small projects that use a large number of regular expressions, It is inferior to Perl. For micro-projects
Shell and Tcl may be better, and Python looks too powerful.

Conclusion: The best thing about Python is that it encourages clear and easy-to-read Code and is especially suitable for constructing large projects in a progressive development mode. The disadvantage is that it is not efficient, too slow, not only slow compared with the compilation language, but also slow compared with other scripting languages.

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.