Ronan Waide wrote:
> UI:
> try {
> store in Database
> } catch {
> burp loudly
> }
>> Database:
> if ( values are ok )
> throw exception
> else
> insert values
I have a problem with this design - and it's mainly to do with the burp
loudly part. If some intermediate layer or the application itself does
validation, you can have the GUI give an error message explaining
what went wrong and what to do about it. If the database "throws an
exception", you have two choices. One, display the error message
returned by the db, probably something along the lines of "Constraint
violated ..." which won't mean anything to the average end user. Or try
and parse the error messages from the database and report something
sensible to the user.
You're always going to need to do some validation directly in the GUI,
unless you want a really unusable GUI.
Nick
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!