x platform development in scala js
play

X-Platform Development in Scala.js Li Haoyi 9 August 2014 Scala - PowerPoint PPT Presentation

X-Platform Development in Scala.js Li Haoyi 9 August 2014 Scala by the Bay What is Scala.js? Scala to JavaScript, run in browser Share code client/server! Get typechecking in your web apps! 1-4x slower than JS, 10x slower


  1. X-Platform Development in Scala.js Li Haoyi 9 August 2014 Scala by the Bay

  2. What is Scala.js? • Scala to JavaScript, run in browser • Share code client/server! • Get typechecking in your web apps! • 1-4x slower than JS, 10x slower than Scala-JVM, 2-6x faster than Python

  3. What’s wrong with (my) JS? • “Who is doing this?” • “Where did this variable come from?” • “Why is it undefined?” • “Why is renaming this method so hard =(” • “I want to refactor this but I’m scared!” • “WTF is going on -.-”

  4. Live coding Client-side Application

  5. Can/Can't Use Can use Can't use • Most of java.lang.* • j.l.Thread, j.l.Runtime, ... • Almost all of scala.* • s.c.parallel, s.tools.nsc • Some of java.util.* • org.omg.CORBA, sun. misc.* • Scala Macros: upickle, scala-async, scalaxy, etc • Reflection: scala-pickling, scala-reflect • Pure-Scala ecosystem: shapeless, scalaz, • Java-dependent: scalatags, utest Scalatest, Scalate

  6. Can/Can't Use Can use Can't use • JS stuff: XmlHttpRequest, • JVM stuff: Netty, akka, Websockets. Localstorage spray, file IO, JNI • HTML DOM, Canvas, • AWT, Swing, SWT, WebGL OpenGL • JavaScript libraries: • Java ecosystem: guice, chipmunk.js, hand.js, junit, apache-commons, react.js, jquery log4j • IntelliJ, Eclipse, SBT • Yourkit, VisualVM, JProfiler • Chrome console, firebug

  7. Show & Tell TodoMVC, Roll, Scala-Js-Fiddle , Ray-Tracer

  8. Why Scala.js • Scala's great and JavaScript not so much • Huge ecosystem of libraries and tools available for free (because Scala, and JS!) • Web apps > Swing apps for deployment • Front-end development in Scala is fun!

  9. Live Coding Server-Client Application

  10. Scala.js • Able to use strengths of each platform • Sharing code/libraries/data-structures between client as server is awesome • Static typing keeps things straight and keeps you sane

  11. Cool Demos • Shared libraries between client & server • Auto-rename routes and Ajax calls! • Find-usages for Ajax endpoints! • Tons of Safety • Tons of Toolability (and Tools!)

  12. Conclusion ● X-Platform dev in Scala.js is awesome ● www.scala-js.org ○ Fork it, make cool stuff ○ Come hang out in the google group ● https://github.com/lihaoyi/workbench-example-app ○ master -> Client example ○ todomvc ○ raytracer ○ autowire -> Server-Client example

  13. Questions?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend