File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes where should i validate? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "where should i validate?" Watch "where should i validate?" New topic

where should i validate?

David Gibson

Joined: Jan 08, 2004
Posts: 24
Hi Guys
I was going to do my validation between the gui and the call to the Data interface. My problem is if sun are going to run tests automatically with the data interface supplied in the exam then none of this validation with be run. In effect I am using the Data interface as a interface to the database file and I have a application layer(run in the same vm as the gui). It is in this application layer that I wish to do my validation
Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
IHMO, it is no hurt to validate in both client and server side, no matter which client type, thin or fat, you choose to implement. In this case, it won't affect your program when sun runs its gui front against your db server.

--------<br />Andy Zhu<br />scjp 1.4<br />scjd 1.4<br />SAS Certified Programmer 9.0
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
IMO, data validation belongs to the model layer of the application. So that, the model layer can be reusable and is not tight to its view. However, adding another validation mechanism in the view layer is helpful to not waste resources (ex. network bandwidth, and database resources). If you have time, then do it twice in the model and the view, and if you don't have time, do it in the model layer only.

SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Steve Taiwan
Ranch Hand

Joined: Jul 01, 2003
Posts: 166
In my experience, when I design J2EE project, I always use java script to validate data before sending them back to server. If the validation happens in server, client has to wait and server has to waste resource for processing useless data. Therefore, in the real world, I will validate data both in client and server side. Not in either client or server side.
In my project, I will validate data both in client and server side.

Steve Taiwan<br />SCJP 1.2, SCJD 1.4, SCWCD 1.3, SCBCD 1.3, OCP 8i DBA, SCEA
I agree. Here's the link:
subject: where should i validate?
It's not a secret anymore!