Turn to Eric Raymond's comments on several major development languages

Source: Internet
Author: User

See the original: http://blog.jobbole.com/79421/

Eric Raymond is the leader of the Open source movement, has a deep knowledge of UNIX development, and presided over the development of Fetchmail. His "Cathedral and Bazaar" is a classic of the open source movement. The following comments on several major development languages are very pertinent, and I have seen better reviews in recent years. In particular, his evaluation of the kind of "simple is good" thinking, it is worth our thinking. I chose to translate some passages for everyone to read and think.

Raymond This article is not in general to talk about the merits and demerits of the language, but to answer a question: Under the UNIX development of open source projects, how to choose development tools? My translation is very scattered, I suggest you go to see the original.


C language

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

C Good portability also adds points to it. But now a lot of other language portability is getting better, and C's advantage in this area may be gradually lost.

Many existing programs can produce very good C code, such as a parser, GUI builder, and so on, and C is also attractive, because the code you need to write is only a small part of the program.

Again, we should certainly know that C language has irreplaceable value to programmers. For each of the languages I'm discussing here, as long as you dig deep enough, you'll see in the end that their kernels are written in pure, portable C.

By this time today, we'd better think of C as a high-level assembly language on UNIX virtual machines.

Even if other high-level languages are perfectly enough to meet your job needs, taking the time to learn C can still be useful, and it will help you think at the level of your hardware system.

Even today, the best C-language tutorial is still the K&r second edition of the C programming Language, published in 1988.

Summary: The best place for C is its high efficiency and proximity to the machine, the worst place in its memory management hell.

C++

C + + was originally released in the middle of the 1980 's, when object-oriented language was considered a silver bullet to solve software complexity problems. The object-oriented nature of C + + makes it all the way beyond C, and advocates think C + + will quickly squeeze the previous generation into the gallery.

But history is not so. The reason, at least in part, is attributed to C + + itself. In order to be compatible with C, C + + was forced to make a lot of major design compromises, resulting in the language is too gorgeous, too complex. In order to be compatible with C, C + + does not adopt an automatic memory management strategy, thus losing the opportunity to correct the most serious problems of C.

Another part of the reason, I am afraid to calculate the object-oriented body. It seems that Oo is not very good to achieve the expectations of the year. I've researched this question and I've found that using OO methods results in a thick layer of bonding between components and a serious maintainability problem. Today, let's look at the open source community, and you'll find that C + + applications are still focused on GUI, games and multimedia toolkits, which are seldom used elsewhere. To be sure, object-oriented is only proven successful in these areas, and the choice of the open source community largely embodies the programmer's free will, not the random direction of the company's management.

There may be a problem with the C + + implementation of OO methods. There is evidence that C + + programs are more expensive than the corresponding C, FORTRAN, and ADA programs over the life cycle. However, it is unclear whether this should be attributed to the OO implementation of C + +.

In recent years, C + + has joined a lot of non-OO ideas, and its unusual ideas like the advent of Lisp,stl are very impressive.

In fact, the fundamental problem with C + + is that it is basically just another traditional language. The memory management in the STL is much better than the previous New/delete and C schemes, but it does not solve the problem. For many applications, the OO feature is not obvious, and compared to C, there is not much benefit in addition to adding complexity.

Summary: The advantage of C + + is that as a compiled language, the combination of efficiency and generics and object-oriented features, the disadvantage is that it is too ornate and complex, tend to encourage overly complex design.

Java

Java's design is smart, it uses automatic memory management, which is the biggest improvement, support OO design benefits, although not so prominent, but also commendable, compared to C + +, its oo design is small and simple.

Java has some notable errors relative to Python. In some places the design is too complex and even flawed. The class visibility and implicit scoping rules for Java are too complex. The interface mechanism is designed to avoid the problems of multiple inheritance, but it is difficult to understand and use it. Internal classes and anonymous classes lead to confusing code. Lack of effective destructors makes it difficult to manage other resources, such as mutexes and locks, in addition to memory. Java threads are unreliable and the I/O mechanism is powerful, but it is cumbersome to read a text file.

Java does not have a mechanism to manage the library version, and thus formally repeating the mistakes of the Windows DLL Hell. In an environment like application servers, this raises a lot of problems.

In general, we can say that Java is better than C + + in most areas, except for system programming and highly efficient programs. Experience has shown that Java programmers seem less likely to construct an overly OO layer like a C + + programmer, but this is still a serious problem in Java.

is Java superior to languages such as Perl and Python? We are not quite sure that much of it seems to be about the size of the program. Its areas of expertise are essentially python-like, and not as efficient as C + +, and in small-scale, heavily-used pattern matching and editing projects that don't rival Perl. In small projects, Java appears too powerful. We suspect that Python is more suitable for small projects, and Java is suitable for large projects, but this is not a strong proof.

Python

Python is a scripting language that can be tightly integrated with C. It can exchange data with dynamically loaded C library modules, or it can be called from C as an inline scripting language. Its syntax is similar to the hybrid of C and modular languages, but there is a unique feature that is to indent the block of statements.

The Python language is very clean and elegantly designed with excellent modularity features. It provides object-oriented capabilities, but does not force the user to object-oriented design. The type system provides powerful expressive power, similar to Perl, with anonymous lambda expressions, which makes Lisp hackers feel kind. Python relies on TK to provide a convenient GUI interface development capability.

In all interpreted languages, Python and Java are best suited to multiple programmers working together to develop large projects in a progressive way. In many ways, Python is simpler than Java, and it's great for building fast prototypes, which makes it a unique advantage for Java: Python is perfect for programs that are neither complex nor highly efficient.

Python's speed cannot be compared to C + +, but in today's high-speed CPUs, the rational use of mixed-language programming strategies makes Python's aforementioned weaknesses effectively remedied. In fact, Python is almost considered the slowest in the mainstream scripting language because it provides dynamic polymorphism. In a small project that uses regular expressions in large numbers, it is inferior to Perl. For micro projects, the shell and Tcl may be better, and Python seems too powerful.

Summary: The best part about Python is that it encourages clear and readable code, especially for building large projects in a progressive way. The flaw is that it is inefficient, too slow, and not only slower than a compiled language, but also slower than other scripting languages.

Turn to Eric Raymond's comments on several major development 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.