The father of Linux shot C ++: the spam language of bad programmers

Source: Internet
Author: User
Tags andrew morton php books version control system

 


[Turing Book recommendation] Linux programming (version 3rd)

The much-anticipated design Bible

[Preface]
It is expected that this article has aroused much attention. After all, C, C ++, and Linux are the most familiar things. However, it is not very interesting for many people to focus on the debate on pure language advantages and disadvantages. One of the protagonists of this debate, Microsoft's Dmitry kakurin, was very correct: "This is a matter of faith. Therefore, any preaching and argument will be endless and meaningless ......"

I think the correct attitude should be to take nutrition from the arguments of experts, improve and deepen their understanding of the relevant language, and combine their actual environment to think about how to learn, how to use it. Meng Yan, Yun Feng, and pongba all have "nutritious" text in this regard. You can check it out.

Each language has its own limitations and has its own best application. Today, software projects are more and more inclined to adopt multi-language development, so it is better to learn more languages than to spend more energy on the competition. Master Andy hunt and David Thomas, who wrote "The path to programmer Cultivation", have long taught us to "learn a new language every year" to be an undefeated place in the software development industry ".

Linux father Linus Torvalds dedicated Version Control Software git for Linux kernel development has aroused widespread attention in the industry. Yesterday, a Dmitry kakurin dude found that he was using pure C instead of C ++ after checking the source code. He bluntly said, "Don't talk about portability, this is an asshole (BS, bullshit ). "(In addition, He also criticized git for its brute-force direct text operations, which were both tedious and error-prone, and it was difficult to keep up with high-level code logic .)


This BS caused a strong reaction from Torvalds. He used"* You *Are full of bullshit. "(you are full of BITs) as your own counterargument. Next, he first turned to the rare fireproofing of C ++:

"C ++ is a bad (horrible) language. In addition, the use of a large number of low-standard programmers makes the situation worse, so that it is easy to generate total and utter crap ). To be honest, C is chosen to kick the C ++ programmer out ....... I have come to the conclusion that any programmer who prefers to use C ++ instead of C development projects may be the ones I want to kick out, so that they won't mess up my projects. C ++ can lead to very bad design choices. Your C ++ programmers always use the 'beautiful' library features of the language as soon as they come up, such as STL, boost, and other complete garbage, this may be helpful to your program, but it may cause:

"-- Endless suffering when the library cannot work (don't tell me anything about STL, especially boost, which is stable and portable. It's not funny at all)

"-- Inefficient abstract programming models. Maybe two years later, you will notice that some of the abstract effects are not very good, but all the code is dependent on the 'beautiful' object model designed around it, if the application is not overwritten, it cannot be corrected.

[Turing Book recommendation] The best C language book in the past 10 years. Teaching Materials for Harvard and MIT:K. N. King C language programming: modern methodsComing soon !!
C language cradle Bell lab training tips "C language confusing" Hot selling

That is to say, the only way to use excellent, efficient, system-level, and portable C ++ is to use all the features of C. Project restrictions only use C, which means that the participants will not be confused, but also will get a lot of programmers who really understand the underlying problems and will not toss those idiots 'object model' junk.

"So I'm sorry, but the so-called advantage of C ++ is a huge error for the software with GIT efficiency as the main target. We will not be able to see this, but it has become a huge additional advantage.

"If you want to use a version control system written in C ++, go to monotone. They actually use 'real-size database', 'pretty object-oriented database', and 'pretty C ++ abstractions '. But to be honest, the final result of all these attractive design decisions for some computer professionals is a pile of terrible, hard-to-maintain spam. "

[Updated 070907] the debate between Torvalds and Dmitry kakurin continues.
In response to Torvalds, Dmitry turned to the opposite side: "as dinosaurs who only use C Programming gradually become extinct, you will soon find that you have to stick to your own opinions. The number of git contributors does not indicate the problem. Obviously, C ++ developers can also contribute C code. But they thought they liked this method, and that would be wrong.

"I use assembly programming when there is no C. Then, before C ++ was born, I switched to C. Now I am using C ++ and C #, and I will not go back. Poor programmers cannot write programs in any language. However, it is a nonsense to punish outstanding developers for rejecting poor contributors for such an unsung reason ."

After just 10 minutes, Torvalds replied: "What's different from you is that I actually gave the reason why I don't like C ++, it also points out some examples of various problems that it may cause. But you didn't give a decent reason to use C ++. In fact, git is better than other software configuration management software, and taste and C are one of the reasons.

In the last sentence, Torvalds then added the following:
"More specific:
"-- Simple and clear core data structures, very lean and ambitious code to manage them," simple is better than fancy"
This method has been used to its utmost.
"-Consciously do not abstract data structures and algorithms, because they are exactly all the elements of git's core (whole point ).

"If you want to use a more fancy language, C ++ is definitely the worst choice. If you want real advanced features, choose garbage collection or
Better system integration, rather than high-level binding (high-level bindings to important concepts), which lacks both sparseness and direct and non-essential concepts of C.

"In a word, C ++ is in a dilemma. It cannot help prototyping or simple GUI programming to simplify and make it available, it is not as positive as C that encourages you to use lean system programming languages constructed in simple and direct languages.

(Another person inserted the following sentence: it is not mentioned that it is difficult to find two C ++ compilers that support the same features .)

 

"This has nothing to do with dinosaurs. Good taste will never expire. Comparing C with the assembly language just shows that you lack a minimum concept of your questions (don't have a friggin idea ). "

[Turing Book recommendation] C ++ Bible C ++ primer Chinese edition and exercise set
C ++ programming specifications that combine the wisdom of C ++ industry experts

[070908 continue update]
The debate continues. After half an hour and half an hour, Dmitry replies:
"As I said, this is a matter of faith. Therefore, any preaching and debate will be endless and meaningless, just like any other religious issue. "

"Let's talk about the reasons why C ++ should be used for git Development (rather than the general reasons why C ++ is better for any project, which is also meaningless ):

"1. A good string class can greatly improve the readability of the Code (and the code will be significantly reduced)
"2. Good buffer class-Same reason as above
3. Smart pointers and smart handles for managing memory and file/socket/lock handles
"For now, it is difficult to see high-level logic through this tedious macro management string and memory.

Then his tone became relaxed, and he even used a smiling face:
"In my opinion, git has a very beautiful high-level design (Object Database, simple and easy-to-access storage using hash, data, and metadata .) I like you!

"But the specific implementation method-the combination of C and shell scripts, the command line interface developed from the bottom up is very general.

"I did not compare C with assembly language. I just want to point out that I used programming in many different languages and witnessed bad programmers writing bad code in any language. Therefore, this is actually irrelevant to the language.

Torvalds is still angry. He refuted Dmitry's Criticism of using macros to manage strings and memory in git:
"It's totally an asshole. String/memory management does not matter at all. Check the source code (I bet you haven't read it ). This is not an important part and is not complicated. The only really important part is design. Some parts are written in a prototype language just because they are not the core and will be slowly replaced by C. C ++ cannot replace shell scripts or Perl code. In addition, C ++ cannot make the real core part better.

"Obviously, you have gone through the 'assembly-> C ++/C # 'transformation process in your life. You have always insisted on comparing C to a 'dinosaur ', it seems that this is an inevitable evolution to a better/more modern language. This is unfounded because C is far better than C ++ (better than C #) in many aspects, including portability, as well as Interface and Low-layer support.

"Of course you can write bad code in any language. However, some languages, especially those with mental burdens, are very bad. New users like you come to point out some absolutely insignificant patch features ([Liu jiangpress] here should refer to C ++'s enhancement features for C ), the fact that they are used as arguments for Language Superiority (not liked by the original authors of these languages) just shows that you are confused and should be aware of them.

"What is really important to git core code is something like writing your own object allocation code so that the memory usage is as small as possible, so as to efficiently record the mark of millions of objects. This is actually a very optimized analysis program for multiple objects in the tree relationship, because there is no abstraction here. This is definitely at the source memory byte level.

"Can these tasks be written in languages other than C? Of course. However, those who think that the advanced features such as C ++ string processing are very important cannot write.

"In fact, this is exactly what C is good. Not only the language itself, but also a necessary mentality ). One of the biggest advantages of C is that it won't make you think of a program as a high-level thing. It is the latter mentality that will clearly make you look at other languages, but in fact, from the GIT perspective, the so-called "Higher Level" is just wrong. "

Dmitry reply:
I not only read the source code, but also did a lot of debugging work. Most of the problems I found are related to processing the path (that is, string processing) on Windows.

He said that he would not be entangled in the discussion of "C and C ++ advantages and disadvantages", but introduced his own starting point:

My goal is to use git. When some functions cannot be used, I want to make corrections and contribute code in the shortest time and effort possible. For me, this is just a pastime of my main work.

The fact that git is written in C is no good for this purpose. We recommend that you use C ++ as the only way out for the existing C code. Therefore, although C ++ may not be the best choice in academic terms, it is the only practical choice.

"Democracy is the worst form of government, except for the ones that have already been tried ."
-- Winston Churchill

Now, I realize that I am only an inactive contributor, but I want my voice to be heard. Those responsible for developing and maintaining git should also make their own voices.

Since then, Torvalds has not spoken again, probably because it thinks that he has achieved a big victory. Some other git contributors continue to refute Dmitry. We can see that Torvalds's views are not his private opinions. Theodore Tso said:

"I think string processing is one of the major problems C ++ will find. A bad Programmer (originally idiot) writes the code like this:

a = b + "/share/" + c + serial_num;

"You certainly cannot figure out how much memory is allocated, because there are type forced conversion and overload operators (thanks to God, You can reload the comma operator in C ++ !), When this kind of thing appears in the internal loop, the result will be a performance disaster, and the reason is not obvious!

In addition, some people say that many c ++ programmers contribute code, but they need to spend more time modifying and deleting the core C programmers.

 

[Liu jiangpress] The following is my opinion on the outside, used as a brick.

Dmitry is definitely correct. The competition for language is more similar to religious beliefs, so it is difficult to have a result and it does not have much practical significance. Because such arguments come from masters, many important information is exposed. For example:

1. For systems with high performance requirements, C ++ is not necessarily better than C. In fact, many such projects Choose C as the main language. The vitality of C is beyond doubt. For more information, see here.

2. c ++ is currently in a situation that has been attacked. On the one hand, in enterprise-level system development (data intensive, complex and changing business rules, c ++ has basically been eliminated by Java and C #. On the other hand, it has been attacked by C in areas closer to hardware such as system programming and embedded.

3. OO technology is not one-size-fits-all.
...... (You can add)

It must be noted that the limitations of C language, as an old language, are also obvious. For example, it has become a security issue that causes buffer overflow. C's standard library also has various problems. There is no object-oriented mechanism for many projects closer to the real world, which obviously affects development efficiency. (For the source code Layer Analysis of the C standard library, Turing will publish the book C standard library by the famous C/C ++ expert plauger .) In addition, even the performance advantages that C programmers are proud of are currently at risk (see the comparison in stroustrup, the father of C ++ ).

C ++'s current dilemma is largely due to the fact that previous books and literature were once prefixed to being brilliant, and were intoxicated by the in-depth exploration of various language details, with the trend of being gorgeous and complicated, Language designers have painstakingly designed a variety of features and multi-model programming styles, but it has become a burden for learners and users, in addition, Microsoft and other development tools use sugar clothing such as MFC. As a result, a large number of C ++ programmers with poor foundation and a few buckets of water are created, and they think they have mastered the most difficult language in the world, it is often arrogant. The code quality developed in this way can be imagined. Various misunderstandings and bad habits of C ++ can be said to be flying over the sky. In this case, C ++ gradually becomes a "expert language" in the eyes of ordinary people, and cannot attract new programmers. The C ++ community is indeed facing a crisis because there are a lot of problems with the elderly and newcomers.

Over the past few years, core figures in the C ++ field, including Bjarne stroustrup, Herb Suter, Stan Lippman, Andrei Alexandrescu, Andrew Koenig, and Stephen Dewhurst, have reflected on this situation a lot, after painstaking consideration, I wrote learning C ++ as a new language) c ++ primer, C ++ programming specifications, accelerated C ++, C ++, and C ++.. The core change is the emphasis on the standard library (STL and boost in Torvalds tone, I do not know why, please tell me), standardization, domain concepts and design, weaken the details of the underlying language, or emphasize the more standard choice of language features.

Compare the fourth and third editions of the same author's c ++ primer, C ++ programming specifications, modern c ++ design, and exceptional C ++ series, you can see this clearly.

For example, the third edition of primer highlights the various programming styles of C ++ (procedural programming, Object-based programming, object-oriented programming, and generic programming) and serves as the main line for layout analysis, it is easy for beginners to faint. In the fourth edition, more efforts are made to lay a solid foundation and introduce the useful and effective programming technologies used in actual development, c ++ has become the backbone of the book, including the selection of facilities, issues to be paid attention to, and outstanding programming practices and mistakes that the industry has summarized. This makes this book the most appropriate encyclopedia for C ++ to learn and use.

C ++ programming specifications, of course, should be used to demonstrate the correct usage and Application of C ++ language facilities in the form of clauses. When you are learning C ++, you can combine the relevant terms to understand the correct usage of the features you have learned. Of course, it is the most ideal. C ++ must know and discuss the important knowledge points of C ++ programmers.

For C ++ Book recommendations, see: C ++ yige (I)

In the end, Dmitry kakurin is a Microsoft engineer (refer to thanks to) and is dedicated to the development of Git on Windows. -- But do not associate with them.

[070909 update] It seems to be in line with Linus Torvalds. The results of the latest issue of the Tianyi programming language index show that C ++ has dropped by two, behind (visual) Basic and PHP, it became the fifth day. C is the second.

Position
Sep 2007
Position
Sep 2006
Delta in position Programming Language Ratings
Sep 2007
Delta
Sep 2006
Status
1 1 Java 21.701% + 0.17% A
2 2 C 14.908% -3.15% A
3 4 (Visual) Basic 10.748% + 0.12% A
4 5 PHP 10.204% + 1.08% A
5 3 C ++ 9.938% -0.82% A
6 6 Perl 5.416% -0.01% A
7 8 C # 3.583% + 0.59% A
8 7 Python 3.025% -0.12% A
9 9 Javascript 2.722% + 0.28% A
10 13 Ruby 2.065% + 1.13% A

 

[Updated in 070910]
As I saw just now, two senior students wrote related discussion articles. In Jiang Wen's words, they are good words that are "nutritious". You can go and have a look:
Meng Yan: the father of Linux is not rough
Cloud wind: Regression of C

[Update on the 070910 night]
Today, I happened to go to The Book "Unix programming art", where Eric Raymond wrote in The compactness section in Chapter 4th:

"In general programming languages, C and Python are semi-compact; perl, Java, emacs lisp, and shell are not (especially the real shell programming requires you to know other tools such as semi-dozen SED and awk ). C ++ is compact-the language designer acknowledges that he does not expect any programmer to fully understand the language ."

[Updated in 070911]
Just now I saw a family photo taken at the Linux kernel developer summit, which has historical value. Let's share it with you. There are Torvalds (roughly in the middle), Andrew Morton (currently the main Maintainer of the kernel, second to the right), and Alan Cox (one of the most contributed hackers in Linux, he is the leader of "Linux Program Design", with a long beard between two pillars) and Jonathan Corbet (author of the book "Linux Device Driver", ranking first on the left) and the book writing partner Greg kroah-Harman (left of the middle pillar), the above-mentioned TSO (right of the middle pillar, reading the resume is also a big bull, IBM) olaf Kirch (author of the Linux Network Administrator guide. There is Yang Li, a Chinese character, and feisikar. Herbert Xu is from Australia, and the Chinese lady Mingming Cao sitting on the ground is from ibm usa.


Monotone is also a free CVS website.

The comparison between C and C ++ is a very interesting topic. What do you think?

[Extended Reading]
Some new terms in the c Standard
C language was selected as the top ten dead and dying it technologies and occupations
Has C ++ lost its competitiveness? Sense of suspension of C/C ++ user's journal
More than 0.1 million Amazon's first PHP books published
News: Linux Kernel support team laid off, CEO left
2007 Open Source Awards

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.