1 / 9

D. and P.

D. and P. D. is a dynamite programmer. Always finishes programs before the rest of the class Has an easy time with even the hardest program P. has a tough time with this class Takes longer than other students to finish programs Finds it hard to figure out how to get the program to work.

Download Presentation

D. and P.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. D. and P. • D. is a dynamite programmer. • Always finishes programs before the rest of the class • Has an easy time with even the hardest program • P. has a tough time with this class • Takes longer than other students to finish programs • Finds it hard to figure out how to get the program to work. • Why does P. always get A’s while D. doesn’t? • Why will P. become a successful software engineer, while D. keeps losing jobs?

  2. Testing • Some programmers find writing programs easy, others take longer • But all programmers, regardless of their skill, can test their software • That’s because testing is mostly ATTITUDE

  3. Testing Attitude • Understand that testing is vital for creating a correct program • Any programmers can produce great programs if they test them thoroughly and don’t deliver them until they’re 100% correct • Even the best programmer will be EMBARRASSED often if testing is not thorough. • No matter how good you are, assume your program is total crap until you’ve proven to yourself that it works in every possible case!

  4. In Short… • Assume a CLOWN wrote your computer program! • Your job is to fix it so it works. • To do that, you need to figure out what’s wrong

  5. The Alternative • Assume your program works • Test it a little because you have to • Prepare to be embarrassed

  6. Some Tips • Never delete a test driver or input tests from the console • Keep your tests around • You will need them if you make changes • Rerun your test driver if you make the slightest change • Test based on what your method DOES not on what’s happening inside

  7. Example, test our average program public static double average (double a, double b, double c){ double d = a + b + c; double e = d / 3; return d; }

  8. Never, never, never do this public static double average (double a, double b, double c){ double d = a + b + c; double e = d / 3; System.out.println(e); return d; } • In your main: double a = average (3.0,4.0,5.0); • Prints 4.0. Program must work

  9. Instead: public static double average (double a, double b, double c){ double d = a + b + c; double e = d / 3; return d; } • In your main: double a = average (3.0,4.0,5.0); System.out.println(a); • Prints 12.0. Program didn’t work after all

More Related