Using serialized JSON to move complex data to and from the browser
Jarod and I have both been working on a FubuMVC application for one of our Guild 3 clients. It?s been great to have the opportunity to work with a different MVC framework and hopefully we?ll comment on what we did and didn?t like about Fubu in a follow up post. I should note at this point that the technique outlined below is not limited to Fubu, in fact it would also work with ASP.NET MVC or even Web Forms.
On one of the Views I had to move a collection of complex data from the client to the server. By complex I mean more than just a single property. An example of this might be editable rows in a table (yes I know that there are other ways to solve this problem such as using AJAX but please stick with me). In addition I didn?t like the fact that there was a duplication of the presentation logic ? server side binding during the initial rendering and client side binding if data was changed. I?ve seen a lot of bugs in the past with this approach when someone makes server or client side changes but forgets about the other piece.
As always any feedback or alternative approaches would be greatly appreciated.