I am trying to implement a simple note organizer with some mind mapping functionality using JavaFX and Scala.
I am trying to decide whether I should call JavaFX code directly from Scala or via ScalaFX ? I don't know if it is worth to learn ScalaFX and would it not be just simpler to directly call JavaFX from Scala code?
The official ScalaFX site mentions 4 benefits of ScalaFX:
1) Natural Language Bind Expressions
-It's nice but I don't really plan using bindings that much (I intend to use EventBus for inter--gui-component events and a few bindings for intra-gui-component events).
2) Tailored Animation Syntax
-I don't plan to use animations in my project.
3) Full Type-Safe APIs
This may seem like an insignificant point… Type safety is something that Java developers have always had (and often take for granted), and developers in other scripting languages live without (and unknowingly suffer with runtime errors as a result). However, it is a critical feature if you are developing applications that cannot have unexpected runtime errors and bugs after deployment.
A good compiler will be able to pick up many common coding mistakes through comparison of expected and actual types, and a great compiler (like Scala) will automatically infer types for you so you don’t have to tediouisly repeat them throughout your code.
ScalaFX gets the best of both worlds with a scripting-like DSL syntax where you can rarely have to explicitly type objects, with the strong type-safety of the Scala compiler that will infer and check the types of every expression and API call. This means less time spent debugging weird code bugs and misspellings, and higher quality code right out of the gate!
-This seems interesting ! But my question is: I suspect that calling JavaFX directly from Scala gives me the same type safety guarantees as calling JavaFX via ScalaFX, or not ? I don't know.
4) Seamless JavaFX/ScalaFX interoperability:
-If I call JavaFX directly from Scala then I don't have to worry more about interoperability issues than when calling JavaFX via ScalaFX.
In summary:
It seems that point 3 is the only one that might give me some benefit that I care about in my simple project but I just don't know what kind of type safety they are really talking about ?
Why is it better to call JavaFX via ScalaFX than directly from Scala with respect to type safety ? What kind of additional type safety benefits do we get if we use ScalaFX instead of direct access from Scala ? I am asking this because I cannot really imagine what kind of additional type safety ScalaFX could give ?
So, in other words, I understand that ScalaFX is a nice syntactic sugar for bindings but does it offer more than that ? Should I really use it if I can live without the (very nice) syntac sugar it gives?
Is there something else than the sugar that would make it worth using this wrapper layer (ScalaFX) which introduces extra complexity (and source of bugs) ?
Please note that I really appreciate the work of ScalaFX's creators ! I am only asking these questions to be able to make a better informed decision.