Testing is itself an extraordinary powerful, learning experience.If you compare how much you learn by spending one hour studying versus one hour taking a test on the same material, you will retain and learn far more as a result of the hour you spent talking a test.
而為了了解到底怎樣的code才是好code,我在google輸入了以下的句子”How good programmer code”,結果我在stack overflow上找到了這個網頁,其中票選回答票數最高的答案是
Good code is well-organized. Data and operations in classes fit together. There aren’t extraneous dependencies between classes. It does not look like “spaghetti.” (良好的結構)
Good code comments explain why things are done not what is done. The code itself explains what is done. The need for comments should be minimal..(最好用code來表達,而不是靠註解。)
Good code uses meaningful naming conventions for all but the most transient of objects. the name of something is informative about when and how to use the object.(好的命名規則)
Good code is well-tested. Tests serve as an executable specification of the code and examples of its use.(經過反覆測試的考驗)
Good code is not “clever”. It does things in straightforward, obvious ways.(好的code易於瞭解、表達明確,而不一定要看起來好棒棒)
Good code is developed in small, easy to read units of computation. These units are reused throughout the code.(unit可重複性高、易於使用、不要太肥大)