Exercise Testable Coding

The individual part is done first, this time.

Individual work: (Tell the group when you are read to discuss.)
When you first started programming, you (probably) were not very concerned about making code that was easier to do testing on.  You were (probably) not concerned about writing code that was easy to modify/generalize.  

As best you can, identify the first few principles you learned for writing testable code. (At least 3)

Be honest: which principles of writng testable code do you know about, but don't like to include in your programs, even now?

If you can, identify a time when writing testable code actually helped you.
For example, you suddenly found you needed to generalize code, or make a function based on code you had embedded in a program, and it was easier because you used at least one principle of writing testable code.

If you can, identify a time when you had a problem, because you did NOT write code as  testable code as you should have.
For example, you suddenly found you needed to generalize code, or make a function based on code you had embedded in a program, and it was harder because you failed to use a principle of writing testable code.

Group work:
Compare your individual answers.
You are in the process of writing project programs.
Your peers will be testing your code.
What are the most important principles of writing testable code that you should use in your project?
What difference would it make, if a peer did NOT use principles of testable code, but you have to test it?
How could you try to catch errors in a peer's project, who might not have written testable code?

(Note: in terms of this class, it helps both your grade, and your peer's grade, when you find a problem that was in their program, and they were able to fix the problem.)

If the professor finds an obvious problem that was not caught by peer review, it is bad for both reviewer and reviewee.  For TODAY, the goal is to appreciate that principles of writing testable code might occasionally be helpful.