[Translator Note] Eric raymond is the leader of open source movement, which has a deep accomplishment for UNIX development, and hosted Fetchmail. His "Cathedral and the Market" were embarrassed by the classics of open source movements. The following is very high in the evaluation of several major development languages, which is the more excellent commentary that I have seen in recent years. Especially the kind of "simple is good" thoughts in his evaluation, it is worth we thinking. I specifically selected some paragraphs for everyone to read. Original article See: http://www.catb.org/~ESR/Writings/taoup/html/ch14s04.html#c_language
Raymond This article is not to talk about the advantages and disadvantages of language, but to answer a question: Develop open source projects under UNIX, how to choose development tools? I translated very zero, I suggest you go to the original text. C Although the C language has serious defects in memory management, it is still known as the king in some applications. For those who require maximum efficiency, good real-time, or closely associated with the operating system kernel, C is still a good choice.
C Good portability is also divided into it. But now many other language portability is getting better and better, and C in this aspect may be gradually lost.
Existing programs can create great C code, such as grammar analyzer, Gui Builder, etc. At this time C language is also attractive, because the code you need to write is just a small part of the entire program.
Moreover, we must of course recognize the road, and the C language has an irreplaceable value for programmers. In every language I discussed here, as long as you are deep enough, you will see their kernels in the end, it is written in pure, portable C.
At this time today, we best regard C as a senior assembly language on the Unix virtual machine.
Even if other senior languages can fully meet your work needs, take time to learn C language is still beneficial, it can help you think about problems at the level of the hardware system.
Even today, the best C language tutorial is still a 1988 published K & R Second Edition THE C Programming Language.
Summary: The best place is its efficient and close machine, the worst place in its memory management hell.
C C was originally released in the mid-1980s, and the object-oriented language is considered to be a silver bomb to solve the problem of software complexity. C object-oriented characteristics will make it comprehensively transcend C, and the supporters think that C will quickly put the previous generation language to the exhibition hall.
But history is not the case. The reason is, at least part of the C itself. In order to compatibility with C, C is forced to make a lot of major design compromises, resulting in excessive language and overcompapers. In order to compatibility with C, C does not use automatic memory management strategies to lose the opportunity to fix C the most serious problem.
Another part of the reason, I am afraid it is going to object oriented. It seems that OO does not have a good idea to achieve the expectations of the year. I have survived this issue, I found that the use of an OO method causes a very thick adhesive layer between the components, and brings serious maintenanceability issues. Today let's take a look at the open source community, you will find that C applications are also concentrated in these aspects of GUI, games, and multimedia tools, rarely used elsewhere. To know that object-oriented is only proven to be very successful in these areas, and the choice of open source communities has largely reflects the free will of programmers, rather than the company's management.
Perhaps C has a problem with the OO method. There is evidence that the cost of the C program throughout the life cycle is higher than the corresponding C, Fortran and ADA programs. However, whether this should be attributed to the OO of C , it is not clear. In recent years, C has added a lot of non-OO's ideas, and its abnormal thinking is similar to Lisp, STL appearance is very great.
In fact, C 's most fundamental problem is that it is basically only another traditional language. The memory management in STL is much better than the previous new / delete and c, but it still does not solve the problem. For many applications, its OO characteristics are not obvious, compared with C, except for increased complexity, no many benefits.
Summary: The advantage of C is to combine the efficiency and generic and object-oriented characteristics as the compilation language. It is the disadvantage that it is too gorgeous and complex and tends to encourage the excessive complex design.
Javajava is very smart. It uses automatic memory management. This is the biggest improvement, which supports the benefits of OO design, although it is not so prominent, but it is worthy of appreciation, compared to C , its OO is small and simple.
For Python, Java has some obvious mistakes. Some places are still too complicated, and even defects. Java's visibility and implicit Scoping rules are too complicated. The Interface mechanism is designed to avoid multi-inheritance, but it is quite difficult to understand and use it. Internal classes and anonymous classes lead to a confusing code. It is difficult to lack effective destructive mechanisms, making it difficult to manage other resources (such as mutual exclusion and lock) other than memory. Java thread is unreliable, its I / O mechanism is very powerful, but reading a text file is very cumbersome.
Java does not have a management library version of the mechanism, so as to repeat the mistakes of Windows DLL hell. This has caused a lot of problems in an environment like the application server.
Overall, we can say that Java is better than C in most areas in addition to system programming and high-efficiency programs. Experience shows that Java programmers do not seem to construct excessive OO layers like C programmers, but this is still a serious problem in Java.
Is Java better than language such as Perl, Python? We are not very clear, it seems that it seems related to the size of the program. It is basically similar to Python in the field, which cannot be compared with C / C , in a small size, a large number of model matching and editing items that cannot be honest. In the small project, Java appeared too much. We guess Python is more suitable for small projects, while Java is suitable for big projects, but this is not a strong proof.
PythonPython is a scripting language that can be closely integrated with C. It can exchange data with dynamically loaded C library module, or as an inline script language to call from C. Its syntax is similar to the hybrid of C and modular languages, but there is a unique feature, which is to determine the statement block.
Python language is very clean, elegant, and excellent modularity. It provides object-oriented capabilities, but does not force users to target object-oriented design. Its type system provides powerful expression, similar to Perl, with anonymous lambda expressions, which makes Lisp hackers feel kind. Python relies on TK to provide convenient GUI interface development capabilities.
In all interpreted languages, Python and Java are best for multiple programmers to develop large projects in progress in progress. In many ways, Python is simpler than Java, it is very suitable for a rapid prototype, which makes it a unique advantage for Java: For those programs that are neither complicated, do not require high efficiency, Python is very suitable. Python's speed cannot be compared with C / C , but on today's high speed CPU, the mixed language programming strategy is reasonably used so that the above weakness of Python is effectively compensated. In fact, Python is almost considered to be the slowest in the mainstream scripting language because it provides dynamic polymorphism. In a large number of small projects using regular expressions, it is inferior to Perl. For miniature projects, shell and TCL may be better, Python is too powerful.
Summary: Python's best place is that it encourages clearly read code, especially suitable for constructing large projects in progressive development. Its defect is that the efficiency is not high, too slow, not only compared with the compilation language, is slower than other scripting languages.