This isn’t another framework, it’s an optimized/reworked “alternate pattern” of MVC in an attempt to solve some of the weaknesses/problems of MVC. Can we decouple the view from the existing architecture stack?
- Kyle Simpson
- 14 March 2010
- Demo of HandlebarJS
- Speaker Feedback
The MVC model doesn’t have a clear space for client-based JS app (a JS version of the app that is not just the presentation logic, but a representation of the app inside the client).
New: “Clients Views Controllers” (CVC)
Application Layer (black box): doesn’t do anything with the presentation layer, no markup; only concerned with state management/session records and representing the data in a standard format: JSON API. Multiple other layers can talk to JSON API, so make it primary communication interface with application layer.
Web Server Layer: translates protocol request to hand off to rest of stack.
“look up state, hands off to controllers, choose a view”
Everything is a client of everything else. Each layer is decoupled, modular, scalable.
Templating, portable, DRY, platform agnostic, uses core web tech.
Task oriented. Controlled by front-end engineer. Less dependence on backend architecture. Small, independent.
Reference implementation: BikechainJS is Kyle’s wrapper around V8. Loads modules to create a hosted environment to run JS. HandlebarJS is a templating engine that uses text/html templates and accepts JSON data input where you cannot call any methods/math. The only logic you can do is to use application “state” for template selection. Compiles templates into JS the first time a template is parsed. Environment agnostic (server or client).
How do I read/write files, i/o, execute processes, conduct network requests? CommonJS is a standards community. Very young.