EmberJS is one of the most comprehensive MVC frameworks of the day - it's "batteries included" (like web2py).
It is inspired by Ruby-on-Rails, in terms of preferring "convention-over-configuration" (like web2py).
It has "sane defaults" for the high-level architecture, so it could require minimal code for standard stuff (like web2py).
The MVC naming-structure is somewhat different, but essentially the same components exist as in web2py.
The Router:
Like in web2py, there is a convention for mapping controllers to views, but unlike web2py, routing (the mapping of URLs to code) is done explicitly.
It is analogous to web2py's "routs.py" file.
The router is doing client-side routing, translating code to URL and vice-versa.
The Model:
Firstly, there is an extension called EmberData that works holistically with EmberJS (but can be used without it) that does all the front-end/back-end synchronization.
It is analogues to web2py's database-abstraction-layer (DAL) architecture, for supporting multiple optional back-ends, and converting data to an ORM (object-relation-model).
As in RoR (ruby-on-rails), the conversion is done via "Adapters" which are like web2py's DAL-drivers.
In RoR it outputs what's known as "Active-Records" - essentially, objects that map to the back-end, and "know" how to save/update data back.
In EmberData you would write:
model = DS.Store.create()
Where in web2py you would write:
db = DAL(<connection-string>)
The data received from the backend, after being converted to ORM objects, is known as "Records".
What is called "Record" in EmberData is essentially like a "Row" object in web2py, and similarly a "RecordArray" in EmberData is analogous to a "Rows" object in web2py.
The View:
In EmberJS, a "view" is somewhat different from what a "view" in web2py, as it deals with user-interaction event-handeling.
However, EmberJS uses "Templates" which are essentially what web2py's "views" are. It even uses very similar templating language with a squirrely-brackets ("{{<somthing>}}").
It has similar uses, so where in web2py, a controller "passes" data to the view, in EmberJS a controller "binds" data to a template.
The difference here is that because it is all client-side, EmberJS can do data-binding - whenever a controller's bound-data changes, the template automatically updates itself in the UI.
Additionally, in EmberJS there are special names that do special things inside a template.
For example:
Where in web2py, the "layout" may have something like:
...
<header>...</header>
...
{{include}}
...
<footer>...</footer>
...
In ember it would be:
...
<header>...</header>
...
{{outlet}}
...
<footer>...</footer>
...
Essentially meaning "everything else inside this template, put here"...
Similarly, where in web2py you would write:
...
{{if someBoolean}}
<div>{{someBoolean}}</div>
{{pass}}
...
<ol>
{{for a in someArray}}
<li>{{a}}</li>
{{pass}}
</ol>
...
In EmberJS it would look something like this:
...
{{#if someBoolean}}
<div>{{someBoolean}}</div>
{{/if}}
...
<ol>
{{#each a in someArray}}
<li>{{a}}</li>
{{/each}}
</ol>
...
Also, where in web2py the mapping of views to controllers is done via folder-structure + file-naming,
in EmberJS it is done via name-mapping of controller-object-name and template-object-name.
The Controller:
In web2py a controller automatically maps to a sub-set of the URL, and may have many functions called "Actions", which each is mapped to a view.
In EmberJS this is further generalized in the "Router", which can contain many nested "Routs", each mapped to a single "controller" via the router and/or naming-convention.
So an EmberJS "Rout" is analogous to a web2py "Controller", and an EmberJS "Controller" is analogous to a web2py "Controller-Action".
This is offers a more flexible hierarchy for the application, as a router can "nest" routs as deeply as you want.
Here are some great (and funny) videos about Ember (watching in order is advisable):
EmberJS (you can skip the live-demo part in the middle, it's not very clear here..)
Live Demo (This one is very clear.)
--
---
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Not a bad argument Arnon, but you shouldn't discount search scrapers so easily.
I think Google's Search Bot has support AJAX for a good 5 years now.
EmberJS is one of the most comprehensive MVC frameworks of the day - it's "batteries included" (like web2py).
It is inspired by Ruby-on-Rails, in terms of preferring "convention-over-configuration" (like web2py).
It has "sane defaults" for the high-level architecture, so it could require minimal code for standard stuff (like web2py).
The MVC naming-structure is somewhat different, but essentially the same components exist as in web2py.
The Router:
Like in web2py, there is a convention for mapping controllers to views, but unlike web2py, routing (the mapping of URLs to code) is done explicitly.
It is analogous to web2py's "routs.py" file.
The router is doing client-side routing, translating code to URL and vice-versa.
The Model:
Firstly, there is an extension called EmberData that works holistically with EmberJS (but can be used without it) that does all the front-end/back-end synchronization.
It is analogues to web2py's database-abstraction-layer (DAL) architecture, for supporting multiple optional back-ends, and converting data to an ORM (object-relation-model).
As in RoR (ruby-on-rails), the conversion is done via "Adapters" which are like web2py's DAL-drivers.
In RoR it outputs what's known as "Active-Records" - essentially, objects that map to the back-end, and "know" how to save/update data back.
In EmberData you would write:
model = DS.Store.create()
Where in web2py you would write:
db = DAL(<connection-string>)
The data received from the backend, after being converted to ORM objects, is known as "Records".
What is called "Record" in EmberData is essentially like a "Row" object in web2py, and similarly a "RecordArray" in EmberData is analogous to a "Rows" object in web2py.
The View:
In EmberJS, a "view" is somewhat different from what a "view" in web2py, as it deals with user-interaction event-handeling.
However, EmberJS uses "Templates" which are essentially what web2py's "views" are. It even uses very similar templating language with a squirrely-brackets ("{{<somthing>}}").
It has similar uses, so where in web2py, a controller "passes" data to the view, in EmberJS a controller "binds" data to a template.
The difference here is that because it is all client-side, EmberJS can do data-binding - whenever a controller's bound-data changes, the template automatically updates itself in the UI.
Additionally, in EmberJS there are special names that do special things inside a template.
For example:
Where in web2py, the "layout" may have something like:
...
<header>...</header>
...
{{include}}
...
<footer>...</footer>
...
In ember it would be:
...
<header>...</header>
...
{{outlet}}
...
<footer>...</footer>
...
Essentially meaning "everything else inside this template, put here"...
Similarly, where in web2py you would write:
...
{{if someBoolean}}
<div>{{someBoolean}}</div>
{{pass}}
...
<ol>
{{for a in someArray}}
<li>{{a}}</li>
{{pass}}
</ol>
...
In EmberJS it would look something like this:
...
{{#if someBoolean}}
<div>{{someBoolean}}</div>
{{/if}}
...
<ol>
{{#each a in someArray}}
<li>{{a}}</li>
{{/each}}
</ol>
...
Also, where in web2py the mapping of views to controllers is done via folder-structure + file-naming,
in EmberJS it is done via name-mapping of controller-object-name and template-object-name.
The Controller:
In web2py a controller automatically maps to a sub-set of the URL, and may have many functions called "Actions", which each is mapped to a view.
In EmberJS this is further generalized in the "Router", which can contain many nested "Routs", each mapped to a single "controller" via the router and/or naming-convention.
So an EmberJS "Rout" is analogous to a web2py "Controller", and an EmberJS "Controller" is analogous to a web2py "Controller-Action".
This is offers a more flexible hierarchy for the application, as a router can "nest" routs as deeply as you want.
Here are some great (and funny) videos about Ember (watching in order is advisable):
EmberJS (you can skip the live-demo part in the middle, it's not very clear here..)
Live Demo (This one is very clear.)
Well, basically, it limited the usefulness of the form facilities and the tight default integration between authentication and the rendered pages took some time to bypass
Well, basically, it limited the usefulness of the form facilities and the tight default integration between authentication and the rendered pages took some time to bypass and then there was stripping the layout.html file to it's bare essentials.
Overall, I've always been much happier to use web2py for it's server-side features and let it be a flexible interface with which 100% custom-made client-side code could interact.
Iy is not going to work in the foreseeable future, for many web-apps to hold their entire database on the client side...
For simple and small web-sites, that may work out, but once you get pass a certain level of complexity, and have hundreds of inter-linking tables, then in most of these cases it would make no sense having an identical data model in the client - it would be horobly wastefull and inefficient to the point of being unusable.
Also, the client-side is still very lacking in terms of options of handling and handling relational data-models.
In short, it would fit a very, well, (ahm..) "boring" target-audience... (no offence...)Not for complex web-apps.
I predict that this would be the model that would emergent to be the dominant one - you already see glimpses of it - Google Wave was an example - even long before web-sockets and data-store on the client.
--
--
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/kXXr9xo_2tM/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
Well, as for the database, there are obvious security issues and performance issues - I mean, having an open connection from all clients to a single back-end database is a pretty nutty prospect for most serious programmers...
And as for No-SQL vs RDBM, well, again, it is a question of target-audience - it depends on the level of complexity of inter-relation in your use-case's data model, so as I said - complex data-model benefit way too much from RDBMs and gain so little from No-SQL that it is simply un-fit for them... But that's a different topic altogether.
As for no-refresh updates of the web-browser, it has nothing to do with meteor/derby or even any kind of real-time app - it is a browser-extension, coupled with a client/server library, that monitors your file-savings of your code, and pushes updates to your development browser. There are many such solutions today for many kinds of browsers and serves - it was just easy to implement in node.js because it's all javascript on both ends... There is nothing fundamentally restricting from doing this with web2py - you can run an instance of node.js that basically only does "that" for you, and still use web2py for all other stuff... It can even be implemented inside web2py itself, with like a worker-thread or something... You can even write something like this yourself - basically poll on file-changes of your javascript code, and stream them over an open web-socket, and parse them on your clien-side code to update your existing page...