Chapter 7. Validation

Make it idiot-proof, and someone will make a better idiot.

Unknown

Adding error-checking and -handling to a GUI application (desktop or web) is something that is usually an afterthought and a horribly tedious chore. Most programmers hate the task, but we have to do it: We can’t just pop up a dialog saying “O NOES!!”—much as we’d like to—if the user does anything wrong. And no matter how simple and elegant we make our applications, two forces are against us:

  • In the Real World, services go down (server crashes, database issues, and so on).
  • The world is full of, um, less sophisticated users.

Worse yet, even advanced UI frameworks have historically provided basically nothing as far as a standard validation framework. ...

Get Flexible Rails 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.