Bloated C ++-over-Packaging

Source: Internet
Author: User

Title:Bloated C ++-over-Packaging

Author:Que rongwen (querw@sina.com)

Date:2010-12-3

Abstract:The abuse of the C ++ object model leads to a bloated C ++ program.

Almost all programmers who use the OO language (C ++, Java) tend to overpackage.
First use the class package layer. the Code levels are very thick. A lot of C ++ source code, due to too many packaging layers, sometimes even packaged for packaging, it is very difficult to read. this is because many things have been abstracted by the original author. If the reader has a poor grasp of the author's design ideas, he may feel confused.

I tendC ++ should only be "C with classes", and STL should be kept in the smallest set.
.

C language is the language closest to the essence of programming. It is free, flexible, and pure language. C is indeed a very small and concise language.
Looking at high-quality C Programs is a kind of enjoyment, and it is the most direct expression of human thinking in understanding the computer world.
The pointers and arrays of C are the most direct embodiment in the computer world. In the memory, data is stored in this way. The CPU is operated by pointers (addresses.
On the contrary, will the C ++ string relate you to the actual memory?

BOOST is a very large library with rich functions. Many BOOST libraries are indeed very good, but too many details are hidden.
It is often said that BOOST is a "quasi" standard library. I hope it will never become a standard library, but it is just a library with rich functions and can be used by anyone who needs it.

Take pai_ptr as an example. The package is very comprehensive, and you can almost forget new and delete with pai_ptr. depending on resource_ptr, I don't know what the resource application and release are. however, this is essential to understanding the computer world. from the operating system perspective, all resources must be applied for and withdrawn.
The excessive packaging of C ++ keeps us away from the essence of the program.
.

For auto_ptr of STL, I think it is just right. It provides intelligent pointer types that are almost the smallest functional requirement. Nothing is needed, and it does not affect the programmer's understanding of pointers and resource concepts.
When using auto_ptr, I knew very well that I just asked auto_ptr to release the applied resources at a suitable time and place.
Using cmd_ptr completely replaces new and delete. I think it is a very stupid attempt. It is equivalent to trying to add the garbage collection mechanism to C ++.
In a free language like C ++, memory management is a pleasure. Memory leakage? That's a programmer's problem.

Why do many C programmers insist on using only C? I dare say that excessive packaging of C ++ is one reason.
The more code layers the more complex the program is, the more error-prone it is.
C programmers have a better understanding of computers than C ++/JAVA programmers.

Linus Torvalds recently developed the Version Control Software Git for Linux kernel:
"C ++ is a bad (horrible) language. and because there are a large number of low-standard programmers who are using it to make the situation worse, it is very easy to generate total and utter crap )"
"Inefficient abstract programming models, maybe two years later you will notice that some of the abstract effects are not very good, but all code is dependent on the 'beautiful' object model designed around it, if the application is not overwritten, it cannot be corrected."
"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."

Although I am a C ++ programmer, I have to admit that Linus Torvalds is right.
The abuse and over-packaging of object models are introducing C ++ into the path. However, can this be a C ++ error?

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.