Re:Scala vs. Node.js as a RESTful back end server (2015)
by daxfohl on Saturday April 23, 2016 @10:39PM
(#11558338)
> thread management in general
That's the beauty of it though; the JVM web server does the thread management so your app code doesn't have to deal with it at all.
> avoids entire classes of problems (like shared state)
Shared state is an orthogonal thing though. You can have shared state in Node or go stateless in Scala. You can have race conditions in either. Node prevents the simple `shared.x = shared.x + 1` problems, but can't ensure anything across callback boundaries. Scala attacks this by making everything immutable by default. Either way, there shouldn't be shared state in a REST app anyway.
> "async call stack"
That is pretty cool. Actually once Javascript gets async/await added to core, then Node could be pretty viable.
That's the beauty of it though; the JVM web server does the thread management so your app code doesn't have to deal with it at all.
> avoids entire classes of problems (like shared state)
Shared state is an orthogonal thing though. You can have shared state in Node or go stateless in Scala. You can have race conditions in either. Node prevents the simple `shared.x = shared.x + 1` problems, but can't ensure anything across callback boundaries. Scala attacks this by making everything immutable by default. Either way, there shouldn't be shared state in a REST app anyway.
> "async call stack"
That is pretty cool. Actually once Javascript gets async/await added to core, then Node could be pretty viable.