What is the profession / preferred way to handle input validation

I am new to C # and SQL. But over the past few years, studying like in college, the question really begins to burn inside of me. There he is:

It seems to me that there are really two very general ways of handling input validation (i.e. checking the required fields and data in the correct ect range).

First, and traditionally shown: as soon as you develop your user interface and somehow connected it to the database. In the user interface, you check the correctness of the input, for example, empty text fields, number ranges or to ensure the selection of a radio or flag, etc.

Secondly, and the method shown in the development of the database: Establish check limits on fields such as valid null values, unique values, and even ranges and required fields.

My dilemma is this. Given that in modern languages, such as C #, you can perform general exception handling, and also considering that maximum league tolerance is built into most databases, such as SQL Server, with respect to handling data changes for all or all. Details like this and to this level would be difficult to program in anything but simple programs.

So my question is: why not build all the requirements directly in the table at the end of the database. Take advantage of the aforementioned fault tolerance and just forget about programming if instructions to ensure the correctness of the data are entered, and instead just use a common catch exception handler if the data has not been executed.

Perhaps this is how it is done, so I really would like to know for sure. If not, why? I prefer to avoid writing code when possible. Less code, less debugging, and less trouble updating. Therefore, I would like to go with this approach to let the database do the work. This is generally the right thing.

, "" . , , , 5 10, , , . , , . ( , ).

.

+5
6

, .

, ( script, , , ). .

, , , , , . , , ( , , , ). , , X , X, Y , , Y .

+6

.

.

, , , . .

+5

. - .

lesss "Code Contracts" - Microsoft.

, . .

, . , , .

+5

, ( , "" ), , SQL.

, "", , . HR 2007 , NULL, NULL, ​​ NULL.

, .

, , . , . , , , , , .

+3

, , , UX "" , , .

. , 20 - . SAP-. , , .

. , .

.

+1

. , , . , , . , , , , . .

, abc. . , , , . , , , , , , , .

, 3 , :

  • ,
  • ,

. , . , . 4- ( -).

, MVC CGI, - ( ), , , , ( , ).

, , , .

:

  • -

:

  • (, windows, linux mac ( 6))
  • (Android, iPhone win phone, 3, 9 ))
  • - CGI

10+ , .

, , - , . 3 4 , .

, , , , , , ...

As the number of client parties grows, modifying well-tested code may not be a good thing. I think this will be a serious headache for the future. I wonder if the design template or best practice will solve it. If anyone knows about one, please tell me.

0
source

All Articles