How To Write A Web App in 6 Programming Languages
PolyglotOr How To Write A Web App in 6 Programming LanguagesChang Sau Sheong Oct 20141
View Slide
* http://spectrum.ieee.org/computing/software/top-‐10-‐programming-‐languages2
*http://blog.codeeval.com/codeevalblog/20143
Programming language wars4
Dependency hell5
Polyglot6
Build your web app with any language7
All at once8
AcceptorHTTPResponderResponderResponderPOST/_/postResponderResponderResponderGET/_/postsAcceptorHTTPAcceptorHTTPBrokerZMQZMQResponderResponderResponderGET/_/post/new9
10Acceptor P
11PBroker
12ResponderYou need to write this
Simple responderrequire 'securerandom'require 'bundler'Bundler.requirebroker = "tcp://localhost:4321"routeid = "GET/_/hello/ruby"identity = SecureRandom.uuidputs "#{routeid} - #{identity} responder ready."ctx = ZMQ::Context.newclient = ctx.socket ZMQ::REQclient.identity = identityclient.connect brokerclient.send_string routeidloop dorequest = String.newclient.recv_string requestresponse = [routeid, "200", "{\"Content-Type\":\"text/html\"}", "Hello World"]client.send_strings responseendDefine route ID and unique responder identityConnect to brokerRegister responderReceive request and process itReturn with response13
Distributed by default14
15BrokerAcceptorResponder Responder Responder
Scale as you like it16
17BrokerAcceptorResponder Responder ResponderAcceptorResponder
Evolve your web app18
19BrokerAcceptorResponder Responder Responder
Still Evolving (need your feedback and help)20
http://github.com/sausheong/polyglot [email protected] @sausheong21