Errors in Software


A problem in your certification application can be defined as anything missing a project parameter. If your application works perfectly , but you forget to include a README.TXT file, you will fail. If you do not meet a key requirement, such as the search feature, you will fail. If you write code to meet all the requirements, but your application doesn't correctly reserve seats when started in remote mode, for example, you will fail. Anything that gets between you and a requirement is a problem.

Problems you should avoid in your solution are broadly categorized in the following (for example, see http://java.sun.com/j2se/1.4.1/docs/api/java/lang/package-summary.html for java.lang list) listed from least severe and easiest to fix to most severe and hardest to fix:

  • Syntax error ” An error caused by mistyping a keyword or forgetting to terminate a statement with a semicolon. The compiler catches these errors and reports them during compilation.

  • Semantic error ” The syntax is correct, but an error occurs because of incorrect meaning in the code, such as casting a String input into an integer instead of a double. The program compiles and runs, but a double would have worked better. (For example, monetary quantities work for whole dollar amounts, but fail if cents are included.) In addition, the program will throw an exception. The evaluator might overlook these tricky problems, unless they cause your application to halt. If the evaluator notices a semantic error, you will lose points.

  • Logic error ” The results are not what you intended. For example, when the user clicks the Reserve button, the program is supposed to reserve a seat and decrement the available seats. However, your program increments available seats by mistake. The program will compile and probably not throw an exception.

  • Runtime error ” Your program causes an error in the JVM, such as a VirtualMachineError error (Java Virtual Machine is broken or has run out of resources). Java will throw an error, as opposed to an exception, and then quit. Refer back to Figure 17.1 for what can be caught and what can't.

  • Environment error ” This type of error is usually out of your control. The program compiles and runs properly until something in the environment causes a problem. For example, someone moves a file that your program has been relying on. Sometimes you can catch these errors as exceptions (for example, a missing file throws java.io.FileNotFoundException ) and sometimes you can't (a file with wrong data, for instance).

  • Requirement error ” This error occurs when you miss a requirement. Everything works fine, but you still fail because you forgot to add a Search button, for example.

  • Project error ” This error, caused by not meeting a project parameter, is considered project mismanagement. For example, you'll fail if you don't upload your solution at Sun's CertManager Web site. E-mailing a perfect solution instead of uploading it is an automatic failure. Another example is not studying enough to supply thorough answers on the essay exam.

  • Business error ” This error is caused by a business misstep. For example, your product was a great idea when you started two years ago, but now it will be poorly received in the market because a competitor beat you there. Two common sources of business errors are cost and time overruns. Perhaps you downloaded the assignment more than a year ago under version 1.3, for example, but Java 1.4 is now the current version.

As you can see, all these errors cause problems and can result in a failing score. Some of them are easy to handle with code (using try-catch-finally , for example) and some are not. For some errors, Java's Error and Exception mechanisms work great, but not for others.



JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net