+1 regarding the AngulaJS talk with web2py by Amber Doctor. Kudos to Amber
for a talk well given!
I've been studying AngularJS a little and haven't written any code, yet,
but my web Spidey sense is giving off alarms. I think Amber's talk
underscores a potential danger of client-side MVC. First, correct me if I'm
wrong, but there's nothing in AngularJS that you can't already do in web2y
using components. The difference is that Angular does it client side
without needing to make an http call, so it potentially runs faster. And
AngularJS seems to have a more compact way of doing things we do in jQuery
with _onclick="blah blah blah" and other such
ajax("url",["target"],":eval"); or web2py_component(...) stuff.
The danger highlighted by Amber's example is that Angular makes it much
easier to create a client-side model that gets out of synch with its
server-side web2py model. And keeping them in synch violates DRY
principles, requiring the http calls that you would have had to do anyway
if you did a web2py-component-only approach.
For instance, if Amber's talk had been about a collaborative recipe app and
someone was updating the recipe database serverside while somebody else was
perusing the db clientside, then it would be easy for the clientside user
to get an out of date recipe and stay ignorant of that fact for a very long
time. That's because the local copy of the data is fetched only once when
the recipe is first clicked, assuming I understood her app correctly.
Further exiting and entering the recipe would not do an http call, whereas
the web2py component approach would naturally force an http call, thereby
keeping the user in synch.
AngularJS seems to offer nifty, high-performance clientside business logic
ability. But unless structured carefully, it's not clear that it'll save
http calls without endangering synch between client and server. And it
could introduce even more complexity in terms of debugging and verbosity in
terms of supporting two MVCs for the same app. The thought of that makes me
wince.
Anybody else have an opinion about this?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.