Would it be difficult to add Blockly to Anvil?

Hi everyone, I’m currently using bubble as a tool for creating web apps, but I’m looking for some other platform that will allow me to do more. I saw that Anvil has amazing features, mainly the ability to work offline or even be packaged as a PWA for mobile devices.
Even though I’m a Python developer and coding isn’t a problem for me, I have a community of people that I consult with on building their apps, the vast majority of whom don’t have programming skills and don’t even want to learn.
If Anvil had some resource to abstract the code it would be great and so I could bring my community together with me to the Anvil universe.
Of all the forms of code abstraction I know, blockly is the one I like the most, it’s still programming but without the need to worry about the syntax.
Thanks for listening.

Welcome to the forum! Here are a few initial thoughts.

Would it be enough to use a tool like this to generate Python code that could be copied in? Blockly  |  Google Developers

Anvil’s representation of a form as a Python class would be a hurdle to integrating such code into an app, though, for starters.

Otherwise, while I suspect it is technically possible to integrate something like that into the Anvil IDE, my sense is that it is difficult and unlikely to happen. Anvil is fundamentally not a “no code” solution. The philosophy behind it is that code is good, that no-code solutions inevitably limit what you’re able to do.

Are you looking for a way to integrate blockly inside Anvil or you want to program Anvil with blockly instead of python, in other words replace python with blockly?

The typical Anvil’s user is either a beginner programmer that wants to learn or an expert programmer that wants to be more productive. I haven’t seen anyone around that…

Both beginners and experts are here to produce apps.

I don’t know blockly, please correct me if I’m wrong, but I’m going to guess that replacing python with blockly is neither going to teach anyone programming skills nor make anyone more productive in creating apps. Sooo… can you please elaborate on what you are thinking about?

I didn’t suggest replacing Python with Blockly, just adding the option. Anyone who wants to code with Blockly is welcome.
My idea with this is to bring an audience that is not a programmer.
I know several low-code and no-code tools, and I can safely say that from the little I’ve seen in Anvil; if there was an abstraction of the code it would be
one of the best tools.

1 Like

In my opinion, Anvil’s autocomplete and IDE features together with the little bits of Python which are needed to perform the sorts of things that can be done with Blockly, are likely easier for absolute beginners to learn, than Blockly.

1 Like

I absolutely agree with @nickantonaccio!

In my experience trying to make the no-code people happy has always been a waste of time. You end up spending little time learning the basic of the no-code tool, a lot of time learning how to do the more complex things the tool can make, a lot lot more trying to figure out how to add some code to reach where the no-code can’t reach. At the end you have code anyway, but it’s an ugly patchwork and it’s limited.

On the no-code-approach defense, there are people that would rather spend weeks trying to get something done in SharePoint or whatever no-code tool without code, upon failure would give money to experts that would do it for them, only to find out that it would have been faster, cheaper and easier to learn a little python and making the same (and much more) tool in Anvil.

I don’t want to kill this feature request. The fact that I wouldn’t make it doesn’t make it bad. But I think it would be better to show the no-code lovers how shorter the learning curve would be with learning python than with learning the quick syntax-less blockly way plus all the libraries, tricks, addins, etc. required to get it to do something useful.

I don’t know blockly, so I could be grossly off target, but I can’t imagine taking any of the Anvil tutorials and doing the same with a no-code approach. The amount of code in the tutorials is very little and they are readable even by people that don’t know any programming. Making them no-code wouldn’t make the learning curve any shorter, because they are so easy that there is basically no learning curve for the little python required.

I can’t imagine the next step either, doing something more challenging, where you start using more services and more complex logic.

So, why am I wasting my time writing this?

Maybe because I kind of hope that adding blockly to Anvil would actually lead somewhere?

You say you are a Python developer and coding isn’t a problem for you. How about you give it a try?

Do you think it would be possible to replace the text editor with a blockly editor, just like @owen.campbell did with neovim?

A young teenager managed to adapt Blockly to Python, so why not have a go at adapting it to Anvil yourself, if that’s what you’d like to see?

I took a look at Edublocks. It certainly seems like it could be integrated. The main benefits, and the basis of the appeal for that sort of system are that:

  • There’s an integrated IDE that users can start in their browser, without any installation, and one click runs the generated Python code.
  • There’s a list of code snippets that users can select by dragging and dropping, so users don’t have to learn and remember all the available pieces of code.
  • The drag and drop editor eliminates potential for syntax errors.
  • It’s physically easier to use for young people who can’t type well yet (I assume dragging and dropping requires less coordination and practice than learning to navigate a keyboard)
  • It’s colorful, friendly and playful looking, so provides an approachable environment that is potentially more likely to appeal to children, in the sense that it appears more like a toy, visually, so that they may become interested in the value and purpose of learning to write code.

The creator of Edublocks basically describes it as an aid to transitioning to writing code, in which ‘the code is on blocks’. As you can see in the screenshot, there’s a 1-1 correlation between a block and a line of code, so the whole idea of the EduBlocks as a transitional tool for education, is that there just really isn’t that much (or really any) difference between the blocks and the code structure. The point is to make the idea of writing code palatable, because it can be seen that the lines of code and the blocks are exactly the same.

I actually created a visual builder tool for Rebol years ago which had the exact same goal, because I could see the clear value in presenting such a psychological advantage: Without Writing Code , so I’m not at all against the idea, and I think that any tool that helps promote the use of Anvil could potentially be useful in building community, getting Anvil used in education, etc.

For use in production, in a professional environment, with adult users who can type, however, I don’t know that the blocks necessarily add any genuine value, and might simply be an unnecessary crutch. Considering that:

  • Anvil has an integrated IDE that users can start in their browser, without any installation, and one click runs the code.
  • Anvil offers a list of code snippets that users can select by copying and pasting, and I think autocomplete provides even more useful contextual guidance, so users don’t have to learn and remember all the available pieces of code.
  • Autocomplete and syntax checking both help to eliminate syntax errors, to much the same end as visually fitted blocks do.
  • Most adults who may consider doing any sort of software development work are likely able to use a keyboard
  • Most adults are likely able to get past not having a child-like playful interface design, an may likely be able to understand the value of writing code

In the end, it would be really neat to see a block interface as a learning tool for Python in Anvil! …but I don’t know that it would necessarily improve Anvil’s ease of use, learning curve, or productive value - at least for adult users who already understand the value of using it, or have a reason to put it to use.