Where Do You Implement Business Rules?

If you write a distributed application, you must take care of minimizing network trips. Therefore, even if the database will reject invalid data, you should check as much as possible on the client side before going to the database. For example, you should ensure that all required data has been entered before even attempting to submit the data to the database. Similarly, if a column only accepts certain values (for example, a Gender column accepting only 'F', 'M', and '?'), you should check the validity of entered data at the client side. Of course, you cannot check everything without accessing the database—some checks require a database lookup, for example, to access the account balance.

As pointed out above, ...

Get Sams Teach Yourself Microsoft® Windows® DNA Programming in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.