Ideally, you want someone else to find your errors. Compiler error checking is your friend because it finds errors you've made immediately and tells you about them. Some development systems use continuous compilation, which informs you about problems as you type with jagged red lines appearing under your errors.
The quality of compile-time error diagnosis is a function of both language and compiler design. The basic Sun javac compiler that many development systems use gives relatively poor error diagnostics. On the other hand, the language design has many helpful features, and more are being added. Java's strong typing (variable types must be declared), required casting are good features, asserts, and exceptions all help produce correct code. Java 5 has further further improved reliability with generics (templates), type-safe enums, and a "foreach" statement. The goal of not allowing illegal programs to compile is impossible, but its interesting to think of how the language design could be improved to help prevent or detect errors at compile time.
No comments:
Post a Comment