Test As You Work
Execute your program often. I like to execute my program basically every time I make a change to the code. Each time you execute, you are checking that your program does what it is supposed to be doing. If you make a whole bunch of changes between executions, you will have a hard time remembering to check that each one of those changes is working. And if one of your changes breaks your program, you will have a very difficult time figuring out which change is guilty. I have made the mistake of writing a lot of code at once and testing at the end. I sometimes write a bunch of code without testing, all the while thinking, “I know what I’m doing. All of this will work.” On rare occasions (three in the last seven years), it all does ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access