These are chat archives for ThoughtWorksInc/Binding.scala

28th
Jan 2017
jfilali
@jfilali
Jan 28 2017 11:04

@Atry : Binding.scala should not be opinionated and it should let the user decide what make sense to him. Personally I can tell you that it is impossible to build a complex Saas UI without custom tags . Because you can easily get more than 4 nested tags. with a lot of different inline definition that can be nested itself with different child trees.
This the only way to get a cleaner Compoments reusable and build complexe UI.
Currently it is still not possible to do that : <MyComponentTest>test</MyComponentTest>
Instead you have to do that <MyComponentTest child="test" ></MyComponentTest>.

Which is not nice. And there is not way to verify at compile time if some properties are missing. I have been trying to use regular scala constructs for that but I reach the maximum level of complexity. Reaching that point we cannot longer develop more cleaner code with Binding.scala. I think this is something important and a real blocker for the people who really like Binding.scala and want to use it in real application.

Not sure what is your opinion on that but it will be great for us to know what is you decide to support that or not so we can do a well aware decision on the future usage of Binding.scala. Also you can also point to us what it would take to change the code and maybe we can build a separate custom build for that. This is my feedback and

Thank you !

杨博 (Yang Bo)
@Atry
Jan 28 2017 11:39
I did not understand what's the meaning of maximum level of complexity
jfilali
@jfilali
Jan 28 2017 17:29
  @dom def apply(usersPage: Var[SubMenuInUsers]) : Binding[Node]= {


      usersPage.bind match {
        case AllUsersPage() =>  AllUsersComponents(
          Graphql.DoAjaxAndReturnDom(
            request = QueryBinding(AllUsersInATable.formGroupDefinitionsFrag, AllUserInATable.usersFrag),

            displayOnSuccess = (result:ValueResult) => AllUsersInATable(
              result.obj("data").obj("formGroupDefinitions").list(),

              result.obj("data").obj("users").list(),

              (result:ValueResult) => SomeNestingComponent(
                  "title",
                  value2,

              )

              onClickUserId = (userId:String) => (e:Event)=> {
                usersPage := SingleUserPage(Var(userId))
              }
            )
          )
        ).bind
        case SingleUserPage(userId) =>  SingleUserMatrix.Container().bind
        case GroupPage =>  GetAllGroupDefinitions().bind
      }

    }
@Atry : This is the kind of code you end up in a real world scenario. It is hard to read and friendly.
there is way to improve it always but in a fast rapid development environment, you need to do it right immediately.
杨博 (Yang Bo)
@Atry
Jan 28 2017 17:32
Do you think <AllUsersComponents> is better than AllUsersComponents()?
jfilali
@jfilali
Jan 28 2017 17:41
```
<AllUsersComponents>
    <GraphQL
        request = {QueryBinding(AllUsersInATable.formGroupDefinitionsFrag, AllUserInATable.usersFrag)}
    >
        <Success>
        {
            (result) => <AllUsersInATable
                definitions = result.obj("data").obj("formGroupDefinitions").list(),
                users = result.obj("data").obj("users").list()
                >
                {
                    (result) => <SomeNestingComponent title ="title", value2 = "value2">


                }
                </AllUsersInATable>
        }
        </Success>

    </GraphQL>
</AllUsesComponents>
```
This is easier to work with, you just copy paste some xml there and there and you extend you application with your own template/components
It look the same but in reality it make a lot of difference.
杨博 (Yang Bo)
@Atry
Jan 28 2017 17:43
        AllUsersComponents(
          Graphql.DoAjaxAndReturnDom(
            request = QueryBinding(AllUsersInATable.formGroupDefinitionsFrag, AllUserInATable.usersFrag),

            displayOnSuccess = (result:ValueResult) => AllUsersInATable(
              result.obj("data").obj("formGroupDefinitions").list(),

              result.obj("data").obj("users").list(),

              (result:ValueResult) => SomeNestingComponent(
                  "title",
                  value2,

              )

              onClickUserId = (userId:String) => (e:Event)=> {
                usersPage := SingleUserPage(Var(userId))
              }
            )
          )
        )
It does not convince me.
I don't know if you have any experience in PHP or Play/Twirl templates.
You may find Binding.scala is very similar with PHP.
jfilali
@jfilali
Jan 28 2017 17:48
No I haven't use PHP or Play/Twirl. I used React in the past. Some people like this notation.
杨博 (Yang Bo)
@Atry
Jan 28 2017 17:51
Do you like colon-equals for assignment or a single equal symbol?
I prefer not to fight convention in these minor things
jfilali
@jfilali
Jan 28 2017 17:54
@Atry : This is a good article but let me give you a example with JavaFX
why is there fxml ?
杨博 (Yang Bo)
@Atry
Jan 28 2017 17:54
Binding.scala supports HTML and FXML, not because we dislike ScalaTags syntax.
Because HTML and FXML are existing languages.
So you can copy and paste them from your favorite design tools