Rough read-chapter6 chapter7

Source: Internet
Author: User

I have to say that Beginners should take a look at these two chapters.

After reading some of them, I can't help but feel that if I first read this book in that year, how nice it would be.

So where is it?

It is good to grasp the psychology of beginners and various humanistic reminders:

All programs start from problems. A good program should be ....

From introducing a question at the beginning-> thinking about the problem-> proposing a design scheme-> trying a design scheme-> Improving the design scheme

-> Complete details of each step-> Test details of each completed step-> overall test

There is nothing special in the above process, but beginners are prone to problems during the above process:

① Specific objective: What are the problems to be solved? We should think about them on the basis of users.

② Another easy mistake is that we are easy to complicate the problem. When describing a problem, we are always too greedy. In fact, a better way is to simplify the problem.

③ Remember that it is of no value to redesign basic modules when writing practical programs.


④ Re-design a prototype program based on existing experience until a satisfactory version is found. Do not continue on a messy version.

Otherwise, it will be more confusing.


⑤ The ideal situation is to gradually build components to write a program, rather than writing all the code at once.

6. Use pseudocode to describe the problem. Do not worry about whether it is a function call or something else, or what parameters are needed.

It is too early to ignore these details when making a policy.

7. Always have doubts about "of course.

 

It is very important to avoid "function spreading" in the early stage of program design. We should first build a simple version.

If the variable function is implemented at the beginning, there is a negative impact: It is difficult to resist the temptation to add "Beautiful features.


The most basic practice of the program is to read the code and guess where the error occurs, but this is usually not a good method. We must understand that the program code is

What to do must be able to explain why it can work correctly sometimes it cannot.

Error analysis is usually the best way to find the correct solution.


NLP keeps searching for simpler methods, which coincides with "Excellent programmers are always lazy.

Not to mention how stroustrup introduces the class token created by itself step by step, how to introduce "Grammar" again, and the final calculator can support variables, "inadvertently", I learned how the compiler works. The introduction of these ideas to guide new things seems so natural and practical at the same time.

____________________________________________________________________________________________

Reflection and gains

In retrospect, I wrote a single-chip microcomputer program at the beginning. At that time, there was no software engineering concept. In my sophomore year, I remember that I could write a module, But how should I build a whole? What if the correct architecture is better for it to work? How can we correctly complete switching between multiple (function) modules and transfer variables to each other? That is to say, how can beginners complete the process from a simple program to a simple hierarchical structure.

Modular(Switching between simple applets and variables)->Hierarchical(Using a state machine, such as a state machine or an automatic machine)->Systemization(Using RTOS)


This process is very smooth and easy for beginners who have computer-related majors or who have good habits of thinking and software engineering training.

However, this process is a bit difficult for beginners who learn and do not see such tips. I remember that it was the first time that I learned the Single Chip Microcomputer in my freshman year. what if I write the program to more than 2 k lines?


How can I cultivate myself correctly when I write a program that is not specialized in computer science? Many people start to look at RTOS after learning a single-chip microcomputer. the most extensive one is to look at μC/oⅱ. other things may look at tiny *** or RTT, djyos, and freertos. some directly go to Linux, WinCE, and Android

Then, can I directly come up? Of course.

Some problems may occur when the foundation is not good enough. For example, some source codes may not be clear when I look at μC/osii. I am not very familiar with some features. for example:


Many C language beginners (of course I am also) in this section may not understand the use of this section. however, the first note in this article is not correct (it should be said that it does not point to the size of the omnipotent pointer anywhere ). (plus, this document can be downloaded. It is a description of the Chinese source code provided by Mr. Zhong changwei. I downloaded it from ourdev.) Mr. Zhong has a question mark in his remarks. maybe Mr. Zhong cannot remember. however, this problem is easy to solve. You can check the typical C language books, for example, <C expert programming>
<C and pointer> <C traps and defects> <C deep anatomy> or even <c
Primer plus>.


However, you may encounter another problem, that is, you have read all the source code, but when you think about it as a whole, you have started to finish some details. it may be hard to remember in a few days. when I was in my sophomore year, I remember reading silly children's books. The last part of the book, <a simple introduction to the AVR Microcontroller: Starting from 88/168/>, talked about the methods and basics of program structuring. but what I remember is"Read the code, write the code, and read the book...", The general idea is so, the original words are forgotten. In fact, this is actually the first Excerpt from the <C ++ Program Design Principles and Practices> ① To the warning and a warm reminder.

 

 
Naturally, after these two stages are completed, it will become a matter of course, and this book has to be said that I was reading it during my freshman year.


 
I remember the importance of these "nonsense" when I took the Single-chip Computer Course in my junior national day. we are all greedy, and it is easy to fall into the "function spread". This can also be done when I write a single-chip microcomputer course to set up a corresponding host computer, "Do you want to join the Database" "load a skin" and so on... these "ambitions" involve too many aspects, but this is not suitable for me.


 
When you are impetuous, you will not actually do it at that time. Because you are anxious to learn more advanced things, it takes time to naturally grow, but it will be better. so this book should be read in the freshman year. step by step learning is the most efficient. the so-called shortcuts will cause bottlenecks. learning with your heart will grow fast.




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.