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
simplejsonis a bit more performant than thejsonmodule in Python 2.6/2.7, so you might want to use that.