PSet2 FAQ
From 6.006 Wiki
(Difference between revisions)
(New page: == Questions == ==general debugging hints== * adding asserts to your code can help you to ensure that values are what you expect them to be at all times * write your code modularly: use s...) |
m (→general debugging hints) |
||
Line 1: | Line 1: | ||
== Questions == | == Questions == | ||
==general debugging hints== | ==general debugging hints== | ||
- | * adding asserts to your code can help you to ensure that values are | + | * adding asserts to your code can help you to ensure that values are what you expect them to be at all times |
- | what you expect them to be at all times | + | |
* write your code modularly: use submethods for any non-trivial repeated or similar code. | * write your code modularly: use submethods for any non-trivial repeated or similar code. | ||
* write unit tests for each of the submethods written | * write unit tests for each of the submethods written | ||
- | * separate complicated computations into smaller pieces which can | + | * separate complicated computations into smaller pieces which can then be asserted on. |
- | then be asserted on. | + | |
* try to find out where the time is going, are some methods being called more often than you expect them to? do they take longer to execute than expected? | * try to find out where the time is going, are some methods being called more often than you expect them to? do they take longer to execute than expected? |
Revision as of 20:39, 4 October 2008
Questions
general debugging hints
- adding asserts to your code can help you to ensure that values are what you expect them to be at all times
- write your code modularly: use submethods for any non-trivial repeated or similar code.
- write unit tests for each of the submethods written
- separate complicated computations into smaller pieces which can then be asserted on.
- try to find out where the time is going, are some methods being called more often than you expect them to? do they take longer to execute than expected?