Debugging a WebObjects Application
Table of Contents Previous Section
Programming Pitfalls to Avoid
This section describes some things to look out for as you debug your application.
WebScript Programming Pitfalls
Because WebScript looks so much like Objective-C and C, it's easy to forget that WebScript isn't either of these languages. When you're debugging WebScript code, watch out for the following tricky spots:
NSString *string1, *string2;
// WRONG!
if (aString1 == aString2) ...
// Right
if ([aString1 isEqual:string2]) ...
The postincrement and postdecrement operators are not supported. If you use them, you won't receive an error message. Instead, they behave like preincrement and predecrement operators.
i = 0;
if (i++ < 1 )
// This code never gets executed.
WebScript always evaluates both sides of a Boolean expression (such as && and ||). You should make sure that the second half of an expression does not produce an error.
// WRONG! produces a divide by 0 if a is 0.
if ((a == 0) || (b / a) > 5) ...
For more information, see the chapter "The WebScript Language".
Table of Contents Next Section