1. REST Inspired Code
Partitioning with a
JavaScript Middleware
Janne Kuuskeri, Tommi Mikkonen
Tampere University of Technology
Monday, April 11, 2011
2. Motivation
Web pages are now
web applications
Web application are too
complex to build
How to make it easier?
Monday, April 11, 2011
3. Current State
Browser Server
Controller
View
Model
JavaScript, CSS,
HTML, JSP, Kid,
Ajax, XML, JSON
eRuby Java, Python, Ruby
Monday, April 11, 2011
4. Problems
Applications are
fragmented over many
different technologies
Responsibilities are
difficult to assign
Traditional software
engineering principles are
difficult to apply
Monday, April 11, 2011
5. How to Make
It Easier?
One language to rule
them all
Fat client
Automatic and more
importantly dynamic
code partitioning
Monday, April 11, 2011
6. Groke
Internet
Web Application Web Application
Groke Client Groke Server
Browser Web Server
Monday, April 11, 2011
7. Implementation
Groke Client Groke Server
JavaScript CommonJS
Ajax Narwhal
JSGI
Jack
Middleware
Monday, April 11, 2011
8. Implementation
Groke Server
Expose interface in terms of resources
Modules : /groke/module/[module]
Functions : /groke/module/[module]/[function]
Constructors : /groke/ctor/[module]/[function]
Objects : /groke/obj/[obj-id]/[property]
Anonymous functions : /groke/func/[func-id]
Monday, April 11, 2011
10. REST?
Functions as resources
RESTful interface is data (resource) driven
Parameters are always POSTed to resources
The platform cannot have any understanding about
the semantics of the resources (possibly functions) it
exposes
Monday, April 11, 2011
11. Future Work
Make Groke symmetric by utilizing Comet or
WebSockets
Make client side wrapper cacheable
Garbage collection
Monday, April 11, 2011
12. Questions?
http://github.com/wuher/groke
Monday, April 11, 2011