NYCPHP Meetup

NYPHP.org

[nycphp-talk] JSON and MVC

Tim Lieberman tim_lists at o2group.com
Wed Jul 15 14:31:28 EDT 2009


On Jul 15, 2009, at 11:59 AM, Hans Zaunere wrote:

>
> So I think I see what you're saying.  Keep all markup (aside from  
> perhaps the initial request) off the server.
>
> I thought about this, and played around with it a bit.  There are a  
> couple of problems, or at least contradictions...
>
> -- everyone I talk to says do as much as you can on the server

Why?  In the sort of app you're describing, the view code is (mostly,  
almost nearly entirely) javascript.

> -- and with good reason, since complex JS is just a hack after another

Don't fear the javascript.  With the various compatibility/helper  
libraries, it's actually a pretty predictable environment to work in.

Look at what the ExtJS guys have done, for example.  Your typical "do  
a desktop-style-app-in-a-browser" application has only enough HTML to  
output a script tag or two and load a stylesheet.

> -- if I do only receive raw "bare-metal" data points via JSON from  
> the server, it seems that the JS complexity gets astronomic, which  
> has obvious problems and frankly greatly reduces overall application  
> agility in my opinion (ie, markup structure, visual appearance, and  
> application logic are once again lumped together).


Yes, the javascript gets complicated, but you can abstract a lot of  
that, with a little elbow grease.

You end up with a javascript environment that looks a lot like the  
event-driven kind of environment from desktop UI libraries.

Now, this kind of architecture isn't going to degrade, let alone  
gracefully, if the user doesn't have javascript, but in many cases  
that ends up being acceptable.




More information about the talk mailing list