News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Brandon Savage's Blog:
Data Formatting It IS Our Job
December 07, 2009 @ 10:26:27

Brandon Savage has a reminder to all of the developers out there about working with input from your users - the burden is on you to format the data correctly, not them.

The simple answer is that whomever designed the form decided to place the validation of the data, and its massaging into the proper format, onto the end user. But there's a more complicated issue at hand here: the fact that the developer either felt it wasn't his responsibility to do the data formatting, or didn't realize that not everyone would think to [input the data] way he does.

He suggests that it's more out of laziness on the part of the developer to want the user to give them the data in the format they want when, really, the application should take reasonably correct (it has to match the type they're looking for, after all) and massage it to what they need. If it doesn't cooperate after this, only then should they toss an error. His examples touch on phone number and date formatting.

0 comments voice your opinion now!
data formatting opinion


blog comments powered by Disqus

Similar Posts

Kevin Schroeder's Blog: Objections to dynamic typing

Zend Developer Zone: DrupalCon '11 Thoughts (Parts 1 & 2)

Hasin Hayder's Blog: What is your favorite IDE/editor for writing code?

KillerPHP.com: Why PHP should be the first language you learn

DevShed: Centralizing the Validation of Data with the Observer Pattern in PHP


Community Events





Don't see your event here?
Let us know!


release community api package bugfix opinion introduction series symfony install framework list voicesoftheelephpant interview laravel library deployment tips podcast language

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework