开发者

Preserving types on the back-end

In order to preserve types during CRUD Ajax requests I want to json encode on the front-end and decode on the back-end. Is this worth doing? Is there going to be a noticeable difference in computing speed/memory between casting particular params as ints and blindly decoding requests with json headers?

Pros: Easier to code back-end commands. Much easier to scale.

Cons: Possible speed/memory overhead.

Background: ExtJS front-end开发者_运维百科, Django back-end. One developer, single website with the hope of multiple developers and websites. :) As of right now I don't plan on having that many CRUD commands where the types are important, but I can see later down the road that there may be a lot of commands that need particular types. Implementing the encoding/decoding functionality should be relatively simple, I'm just worrying that I may be suffering performance for maintainability.

Thanks in advance for any responses.


Encoding/decoding JSON in Django is not going to be an issue performance-wise, although I'd point out that simplejson is a bit more performant than the json module in Python 2.6/2.7, so you might want to use that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜