Hacker News new | past | comments | ask | show | jobs | submit login
Scala React interface: Cross-platform apps using Scalajs (github.com/chandu0101)
63 points by tilt on Oct 12, 2015 | hide | past | favorite | 12 comments



Wow! This is some fantastic stuff. To be (slightly) cynical, I wonder how much code reuse one could get out of this _in practice_. At any rate, I think it's a win to be able to do all of this kind of coding within the same language. Also, being able to bring functional programming, immutability, and types to these different environments is a sure win!


At the very least, you could reuse model code and some (most?) business logic, and likely the data layer as well. Even if you don't reuse any UI code (which seems unlikely), that's still significant.

Edit: In the long run, though, this type of approach opens up the opportunity to abstract low-level differences between platforms in a way that still uses native UI/functionality under the hood. For instance, you could make your high-level components generic enough to be used on any platform, and only change the implementation details per platform. You can do the same with plenty of other APIs as well (local data storage, location, etc).


I've been using 2 distinct languages for FE and BE from the very beginning of my project, and I think that's one the best decisions we made.

It is true, you have to duplicate your models i.e. physically write the same code in 2 languages, but with ORMs this is pretty fast. At later stages, the amount of dup code is always less and less. On the pros-side, this intrinsically prevents you from taking shortcuts, leading to better separation of duties.

It depends on how big you think your project will become, I guess. :)


Taking a task that a JavaScript developer could do and putting a dependency on them being a Scala developer as well isn't a win imo (as a Scala/Javascript dev)


I fully agree. I've done minor things in Java and I've been doing PHP for about 3 years. I've picked up React and I've been trying to get into Scala. It's only been three days, but I think it's not for the faint of heart. I can think of a number of solid front-end devs whose lives would be hell if you threw them into Scala (as an aside, I actually like what I've learned so far, though I wish their 'documentation' was not terrible, though I imagine it's probably done that way since it would be too hard to keep it up to date)


Is this meant to be a replacement for/improvement over scalajs-react [1] or scala-js-react [2] (two other libraries that wrap ReactJS in ScalaJS)?

[1] https://github.com/japgolly/scalajs-react

[2] https://github.com/xored/scala-js-react



How is scalajs now? The last time I checked it out, it baked in about 100KB of overhead into the simple hello world.


According to this[1], as of 2 years ago, hello world was only 2.63KB. It's probably even better now as there have been several releases in the past 2 years.

[1] - https://github.com/scala-js/scala-js/issues/4#issuecomment-2...


20 KB is as low as it gets, these days (not gzipped). But really, that doesn't matter in the least, because you don't write Hello World's with Scala.js. You write larger apps for which the cost of these few tens of KB is completely dwarfed by the size of your application code. Remember that jQuery itself is 40 KB, and nobody complains about it.


My experience too.

But that goes down to like 50k after compression. Some logos are bigger than that.

Not trivial, but for a lot of use cases, that's good enough. Especially if you cache appropriately.


nope.avi




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: