« first day (1752 days earlier)      last day (3188 days later) » 

7:20 AM
MVC question. I have model class which insert data to db. Should I place checks for various data fields on models to see if they are valid? or I should trust my controller for that? Note: controllers validates the data before using model
My opinion on this is, there is no need for double validations.
 
 
2 hours later…
8:58 AM
@Sisir, without being an MVC expert (not even a small one) I would say that most of the time double validation is a good thing to do. One validation is user facing and its aim is to provide meaningful error information to the user, and the other validation is done to ensure that the DB will not be curropted due to wrong values.
Even if you just think OO and class reusability, it is not a good thing to assume that class B is always called only from class A
therefor class B should revalidate even if at this point in time it is only called from class A because when you will change the code in the future and B will also be called from C you will not remember to add the validations
 
9:49 AM
@Sisir Validation is an algorithm, it belongs to a separate class. Not your controller.
 
 
10 hours later…
7:42 PM
Abby T. Miller on August 3, 2015
Welcome to Stack Exchange podcast episode #66, recorded live at Stack Exchange HQ in New York, NY on July 7, 2015. Today's podcast is brought to you by The Association of Ex-Fog Creek Summer Interns (AEFCSI). Today's show is hosted by the usual suspects Jay Hanlon, David Fullerton, and Joel Spolsky, plus ex post facto Producer Alex.
 

« first day (1752 days earlier)      last day (3188 days later) »