Hacker News new | ask | show | jobs
by ssmoot 3810 days ago
If you're doing Scala/Play development, then I kinda feel like you should just use Scala.js. So you get a familiar language, providing the same sort of benefits as Elm, that almost definitely will be around for years to come. There are concerns with the size of the generated code, but on balance it doesn't appear significantly worse than most of the JS frameworks available.

I realize that's a suggestion that will only apply to a relatively small niche in comparison to many of the frameworks discussed, but since I'm a part of that niche... :)

But yeah, you probably should be using something better than ES5. So is it Typescript? Elm? Clojurescript? etc? I think Elm is out. And while the others are probably good, long-term solutions, why learn a new language if you can get more or less the same feature set with something that already integrates with your build-tool/stack? Seems like a no-brainer to me.

And then once you have that, do you really want a client-side "framework"? For some problems maybe... but I feel like if you solve the basic problem of language, that question becomes a lot less relevant.

Just seemed like an appropriate place to vent my own thoughts on the subject lately. I get there are plenty of people that don't care for or aren't excited about Scala for one reason or another, so I'm not attempting to persuade anyone it's the right choice for them.

2 comments

Bear in mind I am asking this question as someone who has no experience in Scala/Play but is looking to learn some new languages/frameworks:

How do the Play framework and Scala.js work with each other? Can I easily write an application is Scala and then sprinkle Scala.js around to perform AJAX data fetching for example?

For someone who knows Scala the tutorial at http://www.scala-js.org/tutorial/basic/ seems pretty thorough.

But the short answer is yes.

There's also this: https://github.com/vmunier/play-with-scalajs-example

And then if you want something interactive but with low commitment, you can give the examples in Typesafe Activator a spin:

  $ brew install typesafe-activator
  $ activator ui
That'll open a browser window. Form there you can open tutorials, step through them while a code panel gets highlighted as you go, edit code in-browser, execute tests and run. All from a single app running in your browser with a 30 second install. It's gotta be the lowest friction intro/development environment ever conceived. Highly recommended if you've never seen it.
Who uses scala.js? I was not under the impression that it was "ready".
It's definitely ready! I can't speak to who's currently using it, but it's got a very impressive ecosystem around it, from when I looked into it months ago.
Let's talk about building an app with 50 independant ScalaJs modules then and how you manage/compose them in one or many of your apps without embedding multiple times the ScalaJs runtime.

Don't forget Scala is slow to compile and ScalaJs is even slower so if you have a monolithic js app it won't scale as a good developer experience.

I'm a backend Scala developer and I'd rather use Elm than ScalaJs until it's clear how to scale ScalaJs apps.

> how you manage/compose them in one or many of your apps without embedding multiple times the ScalaJs runtime

That doesn't make sense. You have code, maybe also dependencies. Scala.js compiles it and produces one JavaScript file with a single runtime and only the bits and pieces of your code and your dependencies that were actually used.

> Don't forget Scala is slow to compile and ScalaJs is even slower so if you have a monolithic js app it won't scale as a good developer experience.

ScalaJS incremental compilation is so fast that it's already done when you switch from the IDE to the browser.