Holochain Playground <> Blockly

Hi there!

So in the last few days I’ve been playing with blockly, and I’ve been able to integrate it in the playground here:

https://holochain-playground.github.io/blockly

To code your own dna:

  1. Click Edit
  2. Compose blocks together to form the code of your DNA.
  • Every function you put there will be transformed into a zome function.
  1. Click Compile. If it’s disabled, it means you have some error in your code.
  2. After compiling, select a node from the DHT Cells widget, and call the functions you’ve created with the CallZomeFns widget below, and watch the network react.

It’s not exhaustive yet, but I think it stills allows a lot of flexibility right now.

My idea is to use this as a learning tool, to introduce people to holochain with as low a barrier as possible, and also as a design tool, where I can go ahead and sketch a design and see how the network will react to my code.

What do you guys think? Do you see it having merit and utility? Would you want to add some new functionality?

15 Likes

Of course, dude! That’s what I’ve been looking for, all my Holochain-life!

It took me months to get comfortable enough with Rust, and even after having understood all the Rust philosophies (which by now I’m in love with; damn garbage-collection, and damn Golang; nothing beats Rust’s memory-management and ownership & safety features), I had to re-read the official Rust-Book thrice (and in fact, I even had to keep it open in a browser tab while coding, especially during the early days); the syntax just doesn’t come natural to new Rustaceans… And even then I barely managed to get some output out of my DNA (and even that was a month ago; god knows whether I’ll manage to get past the multitude of barriers/errors this time or not).

It’s great that our HDK has been written in Rust; that’s one of the best decisions the core team could have taken! But to enforce having to learn Rust on newcomers is kind-of a bit inhospitable (haha)! So, yeah, it’s great that finally you have the exact solution for this million-dollar problem that faces Holochain adoption. You’re the genius, man! Thanks for the Blocky-future that you’re building for Holochain developers.


Just one question:

Are there any benefits of a block-based approach over a nodular (nodes-based) approach (such as https://answers.unrealengine.com/storage/temp/274597-2019-04-18-11-55-41.gif)?


Hum okey yeah, I’m not targeting this for actual zome developing. It’s actually really hard to get from this to developing full-fledged zomes, since for starters blockly has little type checking support. It’s a possibility I consider in the far future, but I don’t think it’s suitable now.

I’m intending this to be much more of a learning resource/design tool. The advantage I see o blockly over those approaches in this context is that the actual flow of the execution is much more clear, although that approach could also be worth investigating.

1 Like

Yeah, that’s what I guessed… I was hoping I’d be able to copy the wasm-DNA-zomes that it produces and share it with the intended users… I hope some day in the late future, it would be as simple as that…

Do you think Blockly would be useful for integrators to assemble components for different user groups? Did you see what @pospi was hinting at in this set of issues?

We keep calling it an Economy Kit, which suggests some software lego blocks. Blockly for assembly, maybe? Or is that not the kind of thing it is good for?

Well they are not “blocks” in the sense of modules, they are “imperative statement blocks”, as in “move here” or “add 2+3”, so not sure how we would go about that. I have other ideas for that problem (which is quite talked about in the holochain ecosystem), that need to be experimented with.

I am very interested and willing to help.

2 Likes

Love the idea! Big Bret Victor fan, anything that is more visual gets my vote :wink:

I have nothing to add apart from when I saw this it reminded me of a project from the people who created the One Laptop Per Child - Music Blocks. They’ve managed to get it into quite a few schools in the U.S. and around the world to help music education and the growth of Free/Libre Open Source Software.

The ‘app’:
https://musicblocks.sugarlabs.org/

The article about the ‘app’:

And this is a great concept to achieve that, thank you. This can really help to understand control flow and logic in Holochain.

Stupid question about blockly please - how do you get a function block defining an input? In your example you have the ‘create_entry’ function with input of contents. But when I’m creating a new zome the only function blocks I see are ‘to do something’, rather than ‘to do something with’.

1 Like

Right, you need to click the small “settings” icon for that function block, which will display options to add inputs. Thanks for the feedback!

ah got it thanks. Told you it was a silly question.