This question statement often comes up.
We’re developing an iOS application, and of course, the user would have to input some personal information before he/she can start using the application. What kind of validations should be implement on the device? Which ones on the server?
Most people, especially when starting out on a new project, consider input validation to be a fairly trivial problem statement with fixed states. But, as the application matures, they fairly quickly realize that every input has its own set of error and valid states. The validation problem grows exponentially with the number of user inputs on the device, as every combination needs its own validation, more or less.
I firmly believe that validation should never be done on the client, unless that’s the only place you need to do it. If there’s even a single server side validation component in the project, the team is better off delegating it entirely to the servers. This makes life much more easier for the front end developers and also makes testing easier. If your application depends on a web service (as most iOS apps do), chances are that the web service would in the near future completely rewrite its required inputs specs and then you will find yourself in a situation where instead of adding new features to your iOS app, you are spending valuable time in trying to get all the client side validations in place. This, until the next time this repeats itself.
That said, there is also a need to think about whether that input is really required. Let’s not forget that iOS devices are mostly mobile gadgets where the users are generally in a hurry to complete a particular task. Even if it’s their first time using the application, forcing them to input personal data which is only partially required is detrimental to the entire user experience. It adds unnecessary validation.
Conversely, if you have an input component in your app, then you necessarily HAVE to validate it. If you’re not validating it, it’s not important, and hence, must be disposed off.
Lessons: Abide by the Apple Human Interface Guidelines, always. Don’t force your users to input more information than is logically necessary for the application to do its job. If you have to perform input validations, do them all at one place, and that place is the server where you have the necessary processing cycles.