i have spa web page. data loaded ajax requests. need show culture sensitive data on page. best way formating kind of data? basicaly have 2 options:
1. send data preformated client (preformat on server)
preformated { durrationinminutes = '2 min' durationinseconds = '120 sec' } pros:
- easy server side implementation (asp.net mvc back-end).
- everything in 1 place (one method in bll).
- smaller javascript
cons:
- posible data duplication (same duration data shown in minutes, seconds i.e. diferent format same data).
2. send raw data client (format on client)
rawdata { durration = 1645678 // milliseconds } pros:
- easier unit testing (we can test in c#)
- easier maintenance - our developers more expirienced in c# then
javascript
cons:
- more work has done on client side
- i'm not sure if data formating can easilly done in javascript
edit
i end client side option
thanks
for simple presentation of data, both methods ok. keep in mind couple of other considerations:
- all data sent client in principle available user, if it's not shown directly. can in situations security issue.
- sending raw data client , letting client handle rest gives more possibilities dynamic viewing on client side
- depending on type of application , data, sending data client can reduce load on server. users slow clients can issue.
if none of these considerations apply, go optimal developing , maintenance. answer depends on local issues, resources, framework used etc.
Comments
Post a Comment