These are chat archives for ThoughtWorksInc/Binding.scala

22nd
Apr 2018
Pascal Mengelt
@pme123
Apr 22 2018 15:58
@mcku I used also in a Typescript project Redux - I created a blog with my findings - trying to adapt redux principles and ideas to the world of scala.js and Binding.scala - maybe you have some ideas;) https://pme123.github.io/scala-adapters/development/binding-scala-redux/
杨博 (Yang Bo)
@Atry
Apr 22 2018 19:25

ensure that the components cannot modify the state

@pme123 What is the purpose of this rule?

杨博 (Yang Bo)
@Atry
Apr 22 2018 19:32

Suppose you are creating an application for both desktop and web. You can share the same store (aka View Model) and external web services for both applications, and create different FXML template / HTML template.

However the two GUIs need some slightly different operations on View Model. Is it really necessary to share all those operations even when some of them are platform-specific?

I want to share some words from ESR's TAOUP
http://www.catb.org/esr/writings/taoup/html/ch01s06.html#id2878263

Rule of Representation: Fold knowledge into data, so program logic can be stupid and robust.

Mustafa Kuscu
@mcku
Apr 22 2018 19:41
This makes me think about platforms other than HTML once again. React has React Native complement, suitable for devices implementation. I suppose FXML is for certain Java desktops. Any ideas on how to reuse the binding.scala app on the mobile in a native way?
杨博 (Yang Bo)
@Atry
Apr 22 2018 19:43
The current FXML syntax shoud apply for Android as well, since Android components are JavaBeans. But I did not test it yet.
Mustafa Kuscu
@mcku
Apr 22 2018 19:44
@pme123 I liked the idea of such a blog. I don't think many people are aware of such a facilitation provided by binding.scala. People still think they are type safe in typescript but the need to put extra effort to keep it type safe given the huge variety of emerging rival untyped javascript paradigms. At some point you give up type safety, at least i have that feeling.
@atry that sounds very interesting and of good utility
杨博 (Yang Bo)
@Atry
Apr 22 2018 19:46
I thought it would be great to create some complex actions on stores for reusing. But I personally will not forbid to access stores directly.
杨博 (Yang Bo)
@Atry
Apr 22 2018 19:52
Seperate of View Model and View could be useful or not, depends on which part tends to be changed frequently.
杨博 (Yang Bo)
@Atry
Apr 22 2018 20:18

@pme123 If you like Redux's immutable store, and still want partial rendering. you can create some intermediate Bindings, which can prevent unchanged value from re-rendering

An example is here:
https://scalafiddle.io/sf/o5fWdS3/2

render2 is not triggered because store2 is unchanged.

Open your browser's inspector to see if it is re-rendered.

Mustafa Kuscu
@mcku
Apr 22 2018 20:20
will look at the fxml example hopefully some day. wondering about how the dev workflow looks like. scenebuilder comes into the scene too?
杨博 (Yang Bo)
@Atry
Apr 22 2018 20:22
I'm not familiar with Android. But the @fxml can mount your bindable data onto any JavaBeans.