GithubHelp home page GithubHelp logo

Comments (6)

waralex avatar waralex commented on July 3, 2024 1

the constructors across Dash backends should be somewhat consistent

I agree with it. I think it's important that a person who has worked with Dash in Python can work with it in Julia or R with minimal cost.
But I also believe that if the features of Julia or R allow you to do something more convenient, or more familiar in the context of a specific language than in Python, then you should give the user this option in addition to the Base API

from dash.jl.

waralex avatar waralex commented on July 3, 2024 1

The following options are available in the master:

app.layout = html_div(...)
layout!(app, html_div(...))
layout!(app) do
    ...
end

div = getlayout(app)
div = app.layout

from dash.jl.

waralex avatar waralex commented on July 3, 2024

In python layout is the property, not method! (the fact that it is implemented via setter method is not important from the point of view of the user interface). In R it is the method.
If we need a property I can convert DashApp struct to mutable struct, then app.layout = .... will work. But it will work with all another properties of DashApp too (I don't see that as a problem yet). I can also add function layout!(app, component) to setup layout. I would also add the overload layout!(layout_maker, app) to be able to use the do ... end syntax if the user doesn't like the hell of nested brackets as much as I do.
I also don't see the point in removing layout_maker from the constructor. I suggest just having two overloads of it - one as it is with layout_maker, the other without it.

If we can make the interface version as close as possible to Python and R, and also using the advantages of Julia to give additional features to the user, then why not do it?

from dash.jl.

waralex avatar waralex commented on July 3, 2024

In fact, maybe I can implement app. layout = ... without having to make the entire structure mutable, but this requires an experiment. So we need a choice - do we implement it as a property, or as a method,or both?

from dash.jl.

rpkyle avatar rpkyle commented on July 3, 2024

In python layout is the property, not method! (the fact that it is implemented via setter method is not important from the point of view of the user interface). In R it is the method.
If we need a property I can convert DashApp struct to mutable struct, then app.layout = .... will work. But it will work with all another properties of DashApp too (I don't see that as a problem yet). I can also add function layout!(app, component) to setup layout. I would also add the overload layout!(layout_maker, app) to be able to use the do ... end syntax if the user doesn't like the hell of nested brackets as much as I do.
I also don't see the point in removing layout_maker from the constructor. I suggest just having two overloads of it - one as it is with layout_maker, the other without it.

If we can make the interface version as close as possible to Python and R, and also using the advantages of Julia to give additional features to the user, then why not do it?

It's true that layout is a property in Dash for Python, and a R6 method in Dash for R. I think we should be pragmatic, and use whatever makes sense in Julia, while also trying to adhere to Dash idioms whenever possible. I agree that it makes sense to work within the idioms of a given language -- there are definitely idioms in Python that I wish existed in R, and vice-versa.

In this case, if a mutable struct will enable application developers to specify app.layout =, then I think that's a reasonable alternative. I'm not as comfortable with Julia as R, so I'm curious if you feel that there are fundamental issues with this approach.

If it's possible to provide the layout!(layout_maker, app) shorthand to abbreviate the layout declaration, while still supporting app.layout = , I don't see any problem with that personally.

As for layout_maker, I defer to @alexcjohnson -- my general perspective is that the constructors across Dash backends should be somewhat consistent, though there's no technical requirement preventing additions to the base API.

from dash.jl.

rpkyle avatar rpkyle commented on July 3, 2024

The following options are available in the master:

app.layout = html_div(...)
layout!(app, html_div(...))
layout!(app) do
    ...
end

div = getlayout(app)
div = app.layout

Great, I'm sure more experienced Julia users will appreciate the additional options you've provided, and app.layout = provides good parity with the Python implementation as well.

Thanks for taking care of these elements, I'm going to close this issue now! 🚀

from dash.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.