6.00.1x - Week 4

4.7.1 Programming Challenges
Check soup for bugs = Testing
Keep lid closed =  Defensive Programming
Clean kitchen = Eliminate source of bugs - debugging

4.7.2 Classes of Tests
Defensive programming:  write specifications for function, modularize programs, check conditions on inputs/output (assertions)
Write code to support easy testing and debugging, module, document constraints, document assumptions
Classes of Tests: Unit testing, Regression testing (rerun unit tests after bug fixing), and Integration testing (multiple unit testings). read 1
How to test: Use intuition, random testing, black box testing (use specification without looking at code), or glass box testing (use/look at code)
Path-complete glass box test: find test cases that go through every possible path in the code.
Glass box Recursion test cases: test recursion depth of 0, 1, and many
While/for loop: loop not executing, executing 1, and executing more than 1

4.7.3 Bugs
Do 3 things: isolate it, fix it, then retest
Overt bug: has an obvious issue: code crashes or runs forever
Covert bug: no obvious issue: code returns a value which maybe incorrect, but hard to spot
Persistent bug: happens every time
Intermittent bug; occurs some times, even if run on the same input, hard to spot
Overt and intermittent:can be handled try/catch

4.7.4 Debugging
Debugging best practice: best: explain your code, even to a rubber ducky.
Debugging Technique: Use binary search idea to insert print statement at halfway in the code. Repeat

IMPORTANCE OF PSEUDOCODE: read




Comments

Popular posts from this blog

Conditional Statements

6.00.1x - Week 2

Basic Machine Architecture