这是袁峰先生在
CSDN论坛一篇贴子中所做的回答,我认为非常值得收藏,便将其翻译了出来。
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:
当你遇到另一个问题/bug的时候,这么做:
1) Think on your own to solve the problem.
1、独立思考解决问题。
2) Read/search for solutions to solve the problem.
2、阅读/查询解决问题的方法。
3) Try to think different ways to solve the problem.
3、尝试不同方法来解决问题。
4) When all those fail, ask for help.
4、当这些都失败后,请求帮助。
5) Write down what you have learned, what you should have done differently to avoid the problem.
5、写下你所学到的东西,以及如何做才能避免这个问题。
For coding:
对于编码:
1) Proof in your mind that your code will work when you write.
1、在你编写代码的同时,根据想象来检验它是否能够正常工作。
2) Ask yourself whether your code is the best solution possible.
2、问问自己,代码是否最佳解决方案。
3) Write unit test programs for your code.
3、为你的代码编写单元测试程序。
4) Step through your new code in a source level debugger, line by line.
4、在源代码一级的调试器中,一行一行调试你的新代码。
5) When an error is reported to you, learn to debug the situation to figure out what is going on, what caused the problem.
5、得到错误报告后,了解调试时的情况以便指出到底发生了什么,又是什么引起问题的。
6) Learn assembly code, check how compiler generates code, learn how virtual function works, learn to debug at assembly code level.
6、了解汇编代码,检查编译器是如何产生代码的,了解虚函数是如何工作的,学习在汇编代码一级调试程序。
Work hard and work smart.
不单单要努力工作,还要学会聪明地工作。
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:
当你遇到另一个问题/bug的时候,这么做:
1) Think on your own to solve the problem.
1、独立思考解决问题。
2) Read/search for solutions to solve the problem.
2、阅读/查询解决问题的方法。
3) Try to think different ways to solve the problem.
3、尝试不同方法来解决问题。
4) When all those fail, ask for help.
4、当这些都失败后,请求帮助。
5) Write down what you have learned, what you should have done differently to avoid the problem.
5、写下你所学到的东西,以及如何做才能避免这个问题。
For coding:
对于编码:
1) Proof in your mind that your code will work when you write.
1、在你编写代码的同时,根据想象来检验它是否能够正常工作。
2) Ask yourself whether your code is the best solution possible.
2、问问自己,代码是否最佳解决方案。
3) Write unit test programs for your code.
3、为你的代码编写单元测试程序。
4) Step through your new code in a source level debugger, line by line.
4、在源代码一级的调试器中,一行一行调试你的新代码。
5) When an error is reported to you, learn to debug the situation to figure out what is going on, what caused the problem.
5、得到错误报告后,了解调试时的情况以便指出到底发生了什么,又是什么引起问题的。
6) Learn assembly code, check how compiler generates code, learn how virtual function works, learn to debug at assembly code level.
6、了解汇编代码,检查编译器是如何产生代码的,了解虚函数是如何工作的,学习在汇编代码一级调试程序。
Work hard and work smart.
不单单要努力工作,还要学会聪明地工作。