Think, think, think, ...
Think, think, think, ...
Not knowing something or making mistake is okay. But what is important is learn from your mistakes and do not repeat them.
When you meet another problem/bug, do the following:
1) Think on your own to solve the problem.
2) Read/seearch for solutions to solve the problem.
3) Try to think different ways to solve the problem.
4) When all those fail, ask for help.
5) Write down what you have learned, what you should have done differently to avoid the problem.
For coding:
1) Proof in your mind that your code will work when you write.
2) Ask yourself whether your code is the best solution possible.
3) Write unit test programs for your code.
4) Step through your new code in a source level debugger, line by line.
5) When an error is reported to you, learn to debug the situation to figure out what is going on, what caused the problem.
6) Learn assembly code, check how compiler generates code, learn how virtual function works, learn to debug at assembly code level.
Work hard and work smart.
//////////////////////////////////////////////////////////////
这是袁峰先生在CSDN论坛一篇贴子中所做的回答
浙公网安备 33010602011771号