"Depth" and "breadth" of C ++ Programming"

Source: Internet
Author: User

C ++ is very complicated-we have heard a lot and believe this statement. But it is actually quite simple. C ++ has a simple idea: "simple problems are solved in simple ways, complex problems are solved in complicated ways .". Of course, this sentence cannot be absolute. The complexity of a problem often comes from multiple sources, such as difficulties in "depth". From this point, we understand that "any one> = 6 is an even number, it can be expressed as the sum of two odd numbers. Although the question is very short to understand, it is indeed a complicated problem because it is a "godebach conjecture ".

The source of complexity can also be the "breadth" of the problem ". For example, it is simple to cook a delicious dish for a person, but today is the weekend. When I come to my house, I feel a complicated problem standing in the kitchen. Not only do I need to know the taste of each of my loved ones, but I do not have to cook cooking dishes, so that the guests can choose what they need. When eight simple questions are combined, they make a complicated question that is difficult to adjust.

A small part of the complex functions in C ++ help us solve complicated problems in depth, but more functions are used to deal with problems in the "breadth. This meets the main market requirements of the software development industry.

Summary: C ++ has a lot of complicated (method or) knowledge points, but they are still dealing with some complicated problems. But when we are learning C ++, can we encounter "complicated" problems? A: few or even none. So can we understand the complicated methods based on some simple questions?

For example, "Object-Oriented ". The father of C ++ has said that C ++ is neither a language nor a pure "Object-Oriented" language. Why? Because "simple things are easy to solve .", The "object-oriented" programming ideology has appeared in history to solve complicated problems that are large enough and has indeed been successful to a certain extent. As a result, everyone is eager for it and has become a required course for programming majors in universities. However, you are not likely to encounter any problems in books that reflect the necessity of "Object Oriented". How do you learn "Object Oriented? Note that it is easy to write a "very object-oriented" program. A Java version of "Hello world" is very oo. However, writing programs in a very "object-oriented" style is definitely not our goal. The goal is to solve the problem. "object-oriented" is a "ideology tool". When we judge that there is no simpler tool to solve a problem, we put our hands into the pocket of the robot cat, ding ding ...... The screen is marked with four big words "Object-Oriented ".

Some of you have to raise your hand against it. The complexity is relative. In danale's eyes, it is very simple. The process-oriented solution can be very beautiful, but in front of beginners, It is a wide range of problems. At this time, as an organizational method, can't "Object-Oriented" help us? If it can help, then we can use it to learn "object-oriented". Isn't it a paper discussion?

Fully agree. Daniel like Linus, who has a deep and wide range of operating systems, thinks that a typical process-oriented language like C can be easily won, he thinks that the language oo like C ++ is just a mess.

The complexity is relative, but when we face or expect the complexity to be "wide, in the general tutorial, it seems that the teaching content and teaching methods that I want to put the C ++ language into the end are not enough. Writing a program of "Tetris" is a "relatively complicated" problem. Open a book titled C ++ primer, with more than 740 pages. If you only look at the knowledge points of C ++, any reader who has learned 227th pages, you should start to write a program for Tetris. At that time, he knew multi-dimensional arrays, so he could define the square data. He knew the if judgment and wrote the collision judgment. He had learned the for loop, so I know how to delete one or more filled rows ......

(Insert a new sentence and you will see Wang write "Do It Yourself")

Some people think that I am a "dumb ". They changed their mind that "Tetris" is a very complicated problem. If students spend a month studying and creating a Tetris, they will make a difference, this completely disrupted the cloud of the original learning plan. Well, I admit that there is indeed a military theory that has been studied for ten years, and then killed the famous Generals on the battlefield. But I prefer to believe that most generals are constantly playing a small battle, he constantly grew up in the night when he picked up the light and watched Wu Mu's suicide note. And I did see that the students who have been overwhelmed by the "Tetris" program and persisted in a month are indeed encountering problems in the future, it has better "tangle" capabilities. Think about it. After learning more than 200 pages of C ++ primer, there was no decent problem, but we had to go through more than one hundred pages, then I began to learn "Part 3 and data abstraction ".

I used "C ++ primer" as a teaching material as a teacher, not once or twice, but every time I began to sell "the nature of object-oriented is not encapsulation, not derivation, not polymorphism, but in abstraction, I always feel so powerless. The soldiers below, they have never played any decent battle, but they want to grow into Barton and Chen Geng in class.

At that moment, I always thought of the words that the father of C ++ said sadly about C ++ education. The general idea is that C ++ education seems to have entered a strange circle: the only way to teach a person C ++ is to teach him as a C ++ master. When I was engaged in C ++ education, I found myself in a strange circle for a long time! Long sigh.

(The above content is not considered by anyone with a normal sense or mentality: The author of this article is saying "C ++ primer" is a poor book .)

For a beginner, after learning "C ++ primer" 227 pages, he will start to write a Tetris game. Where is the complexity?
(1) c ++ beginners (without any other language learning experience) Just Put types, variables, arrays, pointers, if, ......... In the brain, every knowledge point has just begun to be digested. At this time, we need to combine all this together to solve a real problem, just like a person who has just finished reading "Golf Club instructions for use" on the scene, that mess!

(2) No one will think that the Russian square that writes a character interface is very nice, so they have to touch the programming knowledge of a user interface. Window, menu, timer, message, GDI, resource file ...... Mom. This is wide enough.

(3) The routines in the textbooks, such as the grass, the grass, and the grass, have indeed been used for debugging, what single-step tracking, what breakpoint, And what variable observation ...... What else do we need to compile and use the binary method, and how to use the Windows debugging API, such as the "outputdebugstring" function? Do we usually think that we need so many debugging methods on the platform? Now, the program compilation is very difficult, and the program will die when it is run, so it starts to think about how to debug it ......

In 1989 AD, some people asked the chief designer what was the biggest mistake in China's ten-year reform and opening up? He said it was education. (AD 2008 ?) Someone asked the father of C ++ what was the biggest mistake in C ++ in the past decade? Stroustrup says it is also education. The word "also" is purely added by me. The original text is as follows:

Stroustrup says C ++ education needs to improve:

"In the early days of C ++, I was worried that I could not teach teachers quickly enough. I have a reason to worry, because many obvious mistakes in C ++ can trace the misunderstandings of the educators themselves. I am not clear enough to explain my thoughts and principles ." Stroustrup said, "I don't want to teach you how to think. I guess the best way to education is to use a lot of excellent examples ."

Yes, if possible, never teach students how to "object-oriented". Instead, they should be trapped in the ocean of problems, coupled with powerful guidance, finally, let them realize the true meaning of object-oriented.

If I have a son. I don't want to tell him a bunch of reasons about love and responsibility when he grows up to a young age that seems to be familiar with love. I also don't want him to talk about his first girlfriend, so he will immediately enter the marriage smoothly. I hope that, if possible, he would better meet women who are too poor and wealthy and vanity and well-behaved, she was abandoned by a woman, or she was abandoned by others, and then she decided to meet her Cinderella.

Playboy, a man who is not easy to give his or her feelings is often more familiar with the true meaning of love than a young boy who loves to survive when she meets the first woman, after marriage, we often do not fall in love with other women. Why, because people of the opposite sex love to survive. Generally, they love not people, but "love", even if they don't know enough about another person in love.

As a C ++ programmer, when encountering any problem, we need to talk about how people are "object-oriented". When encountering a real problem, people who know how to solve simple problems often get down early. Because their starting point is to fall in love with "Object-Oriented", rather than understanding the problem to be solved.

Similarly, as a C ++ enthusiast, you can fall in love with C ++. But as a programmer, do not say that I fall in love with a language. Love is easy to make people blind; a blind fans is powerful, and he devoted himself to learning. But a blind programmer is terrible and he will think, c ++ is as omnipotent as love.

But I personally, I have my persistence. I will never train my students into fans of C ++ (but BS, the father of C ++, I am enthusiastic about the support :). On the contrary, I will "torture" them. Chapter 2 "Preparations" in "Vernacular C ++" has successfully made many learners complain: "learning C ++, is it necessary to install and compile so many libraries? Or Java, everything is ready ."

The preface to preparation is a lyrical statement: "whether you can become a programmer depends not on your computer foundation, but on your patience ."

In today's society, some women or men may fall in love with the opposite sex. They are snoop. Of course, I am also opposed to this kind of immoral behavior. But if you are learning a language (either a programming language or a natural language), if you have the ability, I suggest you study both at the same time. The more snobbish the learning, the better, it is quite profitable to learn multiple languages at the same time. Generally, a person who is familiar with the c ++ language has this ability. It is unrealistic for beginners who have never studied other programming languages and want to learn another language besides C ++. However, if we only limit the scope of C ++ programming, we must not be infatuated with it. We will put our energy and love on the language itself for a long time.

 

Back to the topic, the complexity of C ++ programming is both deep and wide. The method I recommend is: "There is a certain depth, extended breadth, breadth, and depth ." For more information about the breadth of libraries that can be recommended to beginners, see my another note: several open source libraries recommended to C ++ beginners.
 

-------------------------------------

If you want to communicate with me, click the following link to become a friend:
Http://student.csdn.net/invite.php? U= 112600 & C = f635b3cf130f350c

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.