Developers' Forum

Implement Blockly in Coderunner?

 
Picture of Sergi García
Implement Blockly in Coderunner?
by Sergi García - Saturday, 4 August 2018, 12:50 PM
 

Hi mates.

Blockly is a code generator based on blocks https://developers.google.com/blockly/

I was trying to understand how Coderunner Plugin is made and I was playing with file "renderer.php".

I implemented easily Blockly in Coderunner as proof of concept and I think that it could be useful to be activated for questions for absolute beginners.

What do you think about?

I attach an image of my "Proof of concept" and my renderer.php file as "renderer.txt"

(It is an ugly hack writing HTML directly to $qtext and not following any convention, it was only to make this prototype ).

Regards, Sergi.



Picture of Richard Lobb
Re: Implement Blockly in Coderunner?
by Richard Lobb - Sunday, 5 August 2018, 6:08 PM
 

That's a fun idea!

The way to integrate Blockly into CodeRunner properly would be to use the relatively new UI plugin capability. Have you seen CodeRunner's GraphUI (see the figure below) or the TableUI? But you'd have to implement the entire Blockly UI in JavaScript, which might be a tall order. How's your JavaScript? Or ... perhaps Blockly's already in JavaScript?

Sounds like a good student project, to me.

Richard

Image of an NFA question

Picture of Sergi García
Re: Implement Blockly in Coderunner?
by Sergi García - Monday, 6 August 2018, 7:58 AM
 

Hi Richard.

Blockly is completly done in Javascript.

If you find a student that want to accomplish the project in a proper way, that would be a good idea.

If you can't, I can try to help you an do it myself.

I do the proof of concept directly because I couldn't find in code where are plugins like you show (GraphUI). Is it documented? Which files are?

Regards, Sergi.

Picture of Richard Lobb
Re: Implement Blockly in Coderunner?
by Richard Lobb - Wednesday, 8 August 2018, 10:10 AM
 

Hi Sergi

Certainly I don't have time to do this myself, at least not until the end of the year. And I wouldn't want to make it an integral part of CodeRunner as I feel it's not really where CodeRunner is targetted. But I think it would be a fun extra plugin to have available via coderunner.org.nz.

The user-level documentation of the UIs is here. The JavaScript for the existing plugins is in the amd/src folder, with the compressed versions in amd/build. All code has to conform to Moodle amd module standards. Converting existing code to that standard can be anywhere between very difficult and relatively easy, depending on how it's written. The API for my CodeRunner UI plugins is documented in the module userinterfacewrapper.js.

Have fun!

Richard