hi,
assume i have a huge input form, which of course representing classes. i need this input to be loaded into the class's instances. this input obviously contains (some very complicated validation) checks, obviously the logic layer contains those input validation already. the question is what am i doing with gui.
should i just, in a very ugly way, just rewrite all those validations in the GUI?
or should i write some statics methods in the logic layer, in use those methods in the gui and in the logic layer, but still creating a duplication of the validating it self (first the gui validate itself, then the logic validate what sent to it)
or should i just assume the gui is okay, surround the relevant code that use the logic layer, with a try block, and then, if exception is thrown, inform the user that SOMETHING is not right (without giving him a chance to know what it is)
or should i expose the exception, in which way i expose to him parameters, classes and namespaces names, which he probably won't understand.
or should i make a special exception class for every single error, and this way inform the user exactly what the problem, but creating maybe hundred of possible exceptions
or should i separate it to general exceptions, which everyone include enum describe the exact content of the error, then catch those exceptions, and by checking the enum inform the user what exactly the problem, but make the app heavier by catching unnecessarily exceptions all the time.
or should i (someone has offered this to me, this isn't my idea, don't shout at me :D) to validate the input in the logic layer, and check it only in the gui (seems to be me absolutely horrible solution :D)
and much more important question - where should i learn such things? usually my instincts are pretty good, but i don't want to unnecessarily invent the wheel.. (i'm pretty sure there already conventions for such basic things you bombed into every day).
thank you very much!