Monday, December 24, 2007 12:49 AM
DRY or not?
One of the web applications requirements is to provide a rich user experience. Client side validation and formatting is a part of this UX. The subject I want to address today is how to achieve a good level of UX on formatting with respect to one of the OO principles, DRY principle.
The case is simple, user can edit multiple date inputs, that are reformatted right away. The screen would look like this:
|Item #1 delivery date: || |
|Item #2 delivery date: || |
|... || |
Where's the DRY issue is raising - formatting can be done on server side and on the client side. One of the requirements is to reformat the value right as it is entered. One of the options is to use Ajax - well, a suicidal option. Another one, to invoke some client side code (client presentation logic?) to do the formatting. But as soon as this is done, the logic is replicated on server and client. Or is it?
So how dry is that? Probably not the best solution, so what are your ways to solve this?