Nick Knickerbocker

Greenhorn
+ Follow
since Jan 14, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Nick Knickerbocker

Does the struts validator is good enough to replace all the code written in javascript.



Yes, it's good enough. You would be writing your validation code in straight Java rather than javascript. Struts has some tags for easy display of error messages, and it uses properties files for message resources so you can get away from hard coding the error messages.

Something to consider is that your javascript validation, I would assume, is occuring on the client side. If you use struts, the validation occurs server-side, which of course requires a post. If your app is running on just a LAN, like on a corporate intranet, perhaps the performance difference isn't enough to matter. If it's running on the Internet and it's important to you or your customer to give a very quick response on validation (as opposed to "they screwed up, they can wait," which is also okay), then you may want to at least keep javascript validation for the most common errors.

One course of action is to put the validation in both places. That way your users still get an instant response, but if somebody hacks a post to your page or goes through an API or Web service rather than going through the UI, you can still validate the data coming in. That may be overkill for your purposes though.

Have fun!
20 years ago
Ryan, Looking good man! Greg had good suggestions about the comment type and variable name. Use inline comments within methods. Use descriptive variable names. For other good tips on Java coding style, I recommend the book Elements of Java Style (Vermeulen et al.).

Mala, as with most style guidelines, Greg's suggestions are based on code clarity and readability. As software developers, one of our primary concerns is how well our code communicates its intention. Nested loops are by nature more difficult to comprehend. Sometimes break and continue are useful, but one should take care to make them obvious in code because they violate the normal flow of looping control structures.

Greg, your version of the LCM algorithm looks great, but upon cursory inspection I would have to delete that second-to-last line. Am I wrong?


Cheers to all,
Nick
20 years ago
Thank you for that information Valentin. This concerns me because I am looking at a table layout for the GUI of a PDA-based software product. The easiest comparison I can make would be a high-speed rating system.

The user must only tap their stylus in the correct column for each person, thus allowing the fastest possible entry of information.
The way you explained the ImageItem constants, it seems I would not be able to rely on J2ME to place my user interface elements exactly where I want them. Help?
22 years ago