Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Polyglot

 Polyglot

How To Write A Web App in 6 Programming Languages

Ee191858f0d96ad93098694537f71998?s=128

Sau Sheong Chang

October 10, 2014
Tweet

Transcript

  1. Polyglot Or  How  To  Write  A  Web  App  in  6

      Programming  Languages Chang  Sau  Sheong   Oct  2014 1
  2. *  http://spectrum.ieee.org/computing/software/top-­‐10-­‐programming-­‐languages 2

  3. *http://blog.codeeval.com/codeevalblog/2014 3

  4. Programming   language  wars 4

  5. Dependency  hell 5

  6. Polyglot 6

  7. Build  your  web  app   with  any  language 7

  8. All  at  once 8

  9. Acceptor HTTP Responder Responder Responder POST/_/post Responder Responder Responder GET/_/posts

    Acceptor HTTP Acceptor HTTP Broker ZMQ ZMQ Responder Responder Responder GET/_/post/new 9
  10. 10 Acceptor P

  11. 11 P Broker

  12. 12 Responder You  need  to  write  this

  13. Simple  responder require 'securerandom' require 'bundler' Bundler.require broker = "tcp://localhost:4321"

    routeid = "GET/_/hello/ruby" identity = SecureRandom.uuid puts "#{routeid} - #{identity} responder ready." ctx = ZMQ::Context.new client = ctx.socket ZMQ::REQ client.identity = identity client.connect broker client.send_string routeid loop do request = String.new client.recv_string request response = [routeid, "200", "{\"Content-Type\": \"text/html\"}", "Hello World"] client.send_strings response end Define  route  ID  and  unique   responder  identity Connect  to  broker Register  responder Receive  request  and  process   it Return  with  response 13
  14. Distributed  by  default 14

  15. 15 Broker Acceptor Responder Responder Responder

  16. Scale  as  you  like  it 16

  17. 17 Broker Acceptor Responder Responder Responder Acceptor Responder

  18. Evolve  your  web  app 18

  19. 19 Broker Acceptor Responder Responder Responder

  20. Still  Evolving   (need  your  feedback  and  help) 20

  21. http://github.com/sausheong/polyglot   sausheong@gmail.com   @sausheong 21