How To Write A Web Server In Javascript

Similar documents
Performance Testing for Ajax Applications

An introduction to creating Web 2.0 applications in Rational Application Developer Version 8.0

Enterprise Application Development In Java with AJAX and ORM

Credits: Some of the slides are based on material adapted from

AUTOMATED CONFERENCE CD-ROM BUILDER AN OPEN SOURCE APPROACH Stefan Karastanev

Programming IoT Gateways With macchina.io

ASP.NET: THE NEW PARADIGM FOR WEB APPLICATION DEVELOPMENT

XML Processing and Web Services. Chapter 17

Preface. Motivation for this Book

Performance Testing Web 2.0

Load Testing RIA using WebLOAD. Amir Shoval, VP Product Management

REST web services. Representational State Transfer Author: Nemanja Kojic

Google Web Toolkit. Introduction to GWT Development. Ilkka Rinne & Sampo Savolainen / Spatineo Oy

Developing ASP.NET MVC 4 Web Applications MOC 20486

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

Open Source Technologies on Microsoft Azure

Web Cloud Architecture

What is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World

FormAPI, AJAX and Node.js

Budget Event Management Design Document

Google Web Toolkit (GWT) Architectural Impact on Enterprise Web Application

Adding Panoramas to Google Maps Using Ajax

Chapter 12: Advanced topic Web 2.0

Cloud Powered Mobile Apps with Azure

NoSQL web apps. w/ MongoDB, Node.js, AngularJS. Dr. Gerd Jungbluth, NoSQL UG Cologne,

Developing ASP.NET MVC 4 Web Applications

Web application development landscape: technologies and models

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

Architecture Workshop

ANDROID APPS DEVELOPMENT FOR MOBILE GAME

Introduction to BlackBerry Smartphone Web Development Widgets

Accessing External Databases from Mobile Applications

Web 2.0 Technology Overview. Lecture 8 GSL Peru 2014

Developing Cross-platform Mobile and Web Apps

Framework as a master tool in modern web development

Smartphone Application Development using HTML5-based Cross- Platform Framework

Traitware Authentication Service Integration Document

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Location-Based Information Systems

Transition your MCPD Web Developer Skills to MCPD ASP.NET Developer 3.5 (VB)

Server-Side Scripting and Web Development. By Susan L. Miertschin

Developing ASP.NET MVC 4 Web Applications Course 20486A; 5 Days, Instructor-led

Enterpise Mobility Lexicon & Terminology

SimWebLink.NET Remote Control and Monitoring in the Simulink

Art of Code Front-end Web Development Training Program

The Great Office 365 Adventure

Pentesting Web Frameworks (preview of next year's SEC642 update)

AJAX. Gregorio López López Juan Francisco López Panea

GUI and Web Programming

GOA365: The Great Office 365 Adventure

Implementing Mobile Thin client Architecture For Enterprise Application

Webmail Using the Hush Encryption Engine

Cloud Computing with Windows Azure using your Preferred Technology

How To Build A Web App

ASP.NET Using C# (VS2012)

MarkLogic Server. Reference Application Architecture Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Avaya Inventory Management System

Certified Selenium Professional VS-1083

Concepts of Database Management Seventh Edition. Chapter 9 Database Management Approaches

How To Write An Ria Application

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Cloud Powered Mobile Apps with Microsoft Azure

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

Learning HTML5 Game Programming

Rich-Internet Anwendungen auf Basis von ColdFusion und Ajax

Efficiency of Web Based SAX XML Distributed Processing

Using AppInventor2 for teaching

Introduction to Cloud Computing. Lecture 02 History of Enterprise Computing Kaya Oğuz

WWW. World Wide Web Aka The Internet. dr. C. P. J. Koymans. Informatics Institute Universiteit van Amsterdam. November 30, 2007

Final Report - HydrometDB Belize s Climatic Database Management System. Executive Summary

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

Up and Running with LabVIEW Web Services

Responsive, resilient, elastic and message driven system

Software Architecture for Paychex Out of Office Application

MEGA Web Application Architecture Overview MEGA 2009 SP4

Deepak Patil (Technical Director) iasys Technologies Pvt. Ltd.

SUBJECT CODE : 4074 PERIODS/WEEK : 4 PERIODS/ SEMESTER : 72 CREDIT : 4 TIME SCHEDULE UNIT TOPIC PERIODS 1. INTERNET FUNDAMENTALS & HTML Test 1

Web Browser. Fetches/displays documents from web servers. Mosaic 1993

General principles and architecture of Adlib and Adlib API. Petra Otten Manager Customer Support

Building Java Servlets with Oracle JDeveloper

It is highly recommended that you are familiar with HTML and JavaScript before attempting this tutorial.

Taxi Service Design Description

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

ICE Trade Vault. Public User & Technology Guide June 6, 2014

Equipment Room Database and Web-Based Inventory Management

CSCC09F Programming on the Web. Mongo DB

Software Development Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Lucy Zhang UI Developer Contact:

Building native mobile apps for Digital Factory

TDAQ Analytics Dashboard

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

Benjamin Carlson Node.js SQL Server for Data Analytics and Multiplayer Games Excerpt from upcoming MQP-1404 Project Report Advisor: Brian Moriarty

Transcription:

LIBERATED: A fully in-browser client and server web application debug and test environment Derrell Lipman University of Massachusetts Lowell

Overview of the Client/Server Environment Server Machine Client Machine (Browser) Frontend Code Backend Code Database User Interface Business logic Application Communication Protocol Application Communication Protocol API to web server Web server HTTP

Many Skill Sets Required Client-side languages: JavaScript, HTML In-browser debugging Comms interface JavaScript framework Frontend Code User Interface Server-side languages: PHP, ASP.net Server code debugging Comms interface Database interface Schema design Backend Code Database Business logic Application Communication Protocol Human Factors Visual Design Application Communication Protocol API to web server Web server

Debugging Difficulties Client/server interaction is asynchronous Not possible to step into server code from browser Different people (skill sets) required at client and server Methodologies, techniques differ between client and server

My Research Question Is it feasible to design an architecture and framework for client/server application implementation that allows: 1. all application development to be accomplished primarily in a single language, 2. application frontend and backend code to be entirely tested and debugged within the browser environment, and 3. fully tested application specific backend code to be moved, entirely unchanged, from the browser environment to the real server environment, and to run there?

Desired Architecture Client Machine (Browser) Server Machine Backend Code Backend Code Frontend Code Database Database User Interface Business logic Application Communication Protocol Application Communication Protocol API to web server Web server Web server In Browser HTTP

Research Sub-questions How much of a compromise does this architecture impose, i.e., what common facilities become unavailable or more difficult to use? Does this new architecture create new problems of its own?

The Pieces of the Puzzle Switchable transports Add local transport to talk to in browser server Means to select transport

The Pieces of the Puzzle Switchable transports Add local transport to talk to in browser server Means to select transport JavaScript code to run in browser or on the real server Server side JavaScript Application communication protocol server Database operation abstraction

The Pieces of the Puzzle Switchable transports Add local transport to talk to in browser server Means to select transport JavaScript code to run in browser or on the real server Server side JavaScript Application communication protocol server Database operation abstraction Glue: In browser vs. real server Interface between database abstraction and the simulated inbrowser, and real databases Interface from incoming request to server code

The Pieces of the Puzzle Switchable transports Add local transport to talk to in browser server Means to select transport JavaScript code to run in browser or on the real server Server side JavaScript Application communication protocol server Database operation abstraction Glue: In browser vs. real server Interface from incoming request to server code Interface between database abstraction and the simulated inbrowser, and real databases An application to show that the architecture works

Introducing LIBERATED Liberates the developer from the hassles of traditional client/server application debugging and testing Currently supports: Simulation environment (in browser) App Engine Jetty / SQLite Implemented with qooxdoo JavaScript framework Provides traditional class based object programming model LIBERATED could be used when developing a nonqooxdoo based application

The Pieces of the Puzzle Switchable transports Add local transport to talk to in browser server Means to select transport JavaScript code to run in browser or on the real server Server side JavaScript Application communication protocol server Database operation abstraction Glue: In browser vs. real server Interface from incoming request to server code Interface between database abstraction and the simulated inbrowser, and real databases An application to show that the architecture works

Transports Client (browser) Application Application Communication Protocol (e.g., RPC, RESTful) Transports XMLHttpRequest Script IFrame Server Web Server

Adding a Simulation Transport Client (browser) Application Application Communication Protocol (e.g., RPC, RESTful) Simulated Web Server Transports XMLHttpRequest Script IFrame Simulation Server Web Server

The Pieces of the Puzzle Switchable transports Add local transport to talk to in browser server Means to select transport JavaScript code to run in browser or on the real server Server side JavaScript Application communication protocol server Database operation abstraction Glue: In browser vs. real server Interface from incoming request to server code Interface between database abstraction and the simulated inbrowser, and real databases An application to show that the architecture works

Server-side JavaScript Rhino Mozilla Foundation SpiderMonkey Embedded in some Mozilla products V8 (Node.js) Used in the Chrome browser Via Rhino: any Java environment

In-browser or real server: Application Communication Protocol Common approaches REST (Representational State Transfer) RPC (Remote Procedure Call) XML RPC JSON RPC (Very easy to implement in JavaScript) Grow your own

In-browser or real server: Database Abstraction Abstract class: Entity Entity Class Entity Instance Class Functions query ( ) Retrieve data from one or more entity types in the database registerpropertytypes ( ) Specify the field values for this type of entity registerdatabaseprovider ( ) A specific database server registers its handlers for all primitive operations putblob ( ) getblob ( ) removeblob ( ) Manage large objects Instance Properties data Per-entity field data brandnew Whether this entity was first retrieved from the database uid Unique auto-generated key, if no key field is specified Instance Methods put ( ) Write this entity to database removeself ( ) Delete this entity from database

Entity Type definition for a simple counter qx.class.define("example.objcounter", { extend : liberated.dbif.entity, construct : function(id) { this.setdata({ "count" : 0 }); this.base(arguments, "counter", id); }, defer : function() { var Entity = liberated.dbif.entity; Entity.registerEntityType(example.ObjCounter, "counter"); } }); Entity.registerPropertyTypes( "counter", { "id" : "String", "count" : "Integer" }, "id");

RPC implementation qx.mixin.define("example.mcounter", { construct : function() { this.registerservice( "countplusone", this.countplusone,[ "counterid" ]); }, members : { countplusone : function(counter) { var counterobj, counterdataobj; liberated.dbif.entity.astransaction( function() { counterobj = new example.objcounter(counter); counterdataobj = counterobj.getdata(); ++counterdataobj.count; counterobj.put(); }, [], this); } }); } return counterdataobj.count;

A second example, using a query // Issue a query of dogs. results = query( "app.dog", // Entity type to query. { // search criteria type : "op", method : "and", children : [ { field : "breed", value : "retriever" }, { field : "training", value : "search" }, { field : "age", value : 3, filterop : ">=" } ] }, [ // result criteria { type : "limit", value : 5 }, { type : "offset", value : 10 }, { type : "sort", field : "age", order : "desc" } ]); SQL equivalent: SELECT * FROM app.dog WHERE breed = 'retriever' AND training = 'search' AND age >= 3 SORT BY age DESC OFFSET 10 LIMIT 5;

The Pieces of the Puzzle Switchable transports Add local transport to talk to in browser server Means to select transport JavaScript code to run in browser or on the real server Server side JavaScript Application communication protocol server Database operation abstraction Glue: In browser vs. real server Interface from incoming request to server code Interface between database abstraction and the simulated inbrowser, and real databases An application to show that the architecture works

Glue: Using common code in browser or real server Web server interface: Request arrived Sending response Interface with database Simulation database App Engine datastore SQLite

The Pieces of the Puzzle Switchable transports Add local transport to talk to in browser server JavaScript code to run in browser or on the real server Server side JavaScript Application communication protocol server Database operation abstraction Compiling JavaScript to Java's.class format Glue: In browser vs. real server Interface from incoming request to server code Interface between database abstraction and the simulated inbrowser, and real databases An application to show that the architecture works

Incorporating into an application: App Inventor Community Gallery App Inventor (Google / MIT) Blocks programming language (puzzle pieces) Similar to Scratch, Lego Mindstorms environments Destination: Android phones App Inventor Community Gallery Sharing of source code, libraries, components Social aspects: Like It!, comments Developed and tested using in browser backend Unit/regression tests for individual RPC implementations and for full RPC round trip invocation Runs on App Engine

Related Work Nothing else fully answers my research question??? Areas of related work Google Web Toolkit (GWT) Plain Old Webserver Wakanda

Conclusions Is it feasible to design an architecture and framework for client/server application implementation that allows: 1. all application development to be accomplished primarily in a single language, 2. application frontend and backend code to be entirely tested and debugged within the browser environment, and 3. fully tested application specific backend code to be moved, entirely unchanged, from the browser environment to the real server environment, and to run there? YES! (with caveats)

Compromises and New Problems Imposed by This Architecture Compromises Browser database capabilities are limited Limited number of property types Required schema Conversion from native language to JavaScript Database driver mappings difficult? New problems Server side JavaScript is still young Plentiful libraries of code available elsewhere are not yet here (but Node is quickly solving this)

Future Work Rigorous evaluation of LIBERATED vs. more traditional development paradigms. Determine impact of described compromises May require implementing parallel environment in different language Object relations Currently ad hoc, enforced by application Better browser based persistent storage Indexed Database instead of localstorage? Additional operators in queries Currently only and is supported

Source Code LIBERATED https://github.com/liberated/liberated App Inventor Community Gallery https://github.com/app inventor gallery/aig