Feedback on code and how to create a GUI

After a long time I picked up Scala again. I really like working with it again. But it is a bit of a paradigm shift. I shared the code:
https://github.com/CecilWesterhof/Mancala

I would appreciate feedback on the code. What is good, what should I do differently, …

Also I want to create a GUI. Until now I have been mostly a back-end developer, so some tips how to create a nice GUI (for this particular application) would be welcome.

These days, my usual recommendation is to build a web client for the GUI. Scala.js is now solidly mature, and there are facades for most of the major web frameworks, so you can do real client programming more or less completely in Scala…

Personally I would prefer a ‘real’ GUI, but it would not hurt to look into this.

For a desktop app with Scala on the JVM, you can look into ScalaFX, a thin Scala wrapper around JavaFX. I’ve used it a bit and it seems to work fine, and seems quite a bit nicer to use than older Java GUI frameworks (like Swing) from what I’ve seen. There are a few drawbacks to keep in mind:

  • Oracle no longer seems particularly interested in developing JavaFX (although it’s now an open source project, so it won’t just disappear overnight);
  • ScalaFX certainly doesn’t have a large community around it;
  • While ScalaFX makes the JavaFX APIs a lot more Scala-friendly, the basic paradigm still clearly comes from the Java world.

Another alternative would probably be to write a web GUI (with Scala.js) but package it as a desktop application with something like Electron. I haven’t seen examples of doing that with Scala.js yet, so I can’t help with that, but it certainly should work?

1 Like

Not 100% the same thing, but GitHub - laughedelic/atom-ide-scala: ⚛ Scala & Dotty support for Atom IDE (🧟‍♂️ zombie repo) is an Atom plugin written in Scala.js.

Could I take the liberty of drawing your attention to my own repository: openstrat. You might find it useful in building cross platform GUIs.