Blockly to Reveal Java helping to teach

I had a few students today working in their blockly coding that were interested in the Java behind it. While they would definitely do well to take online courses in Java, both myself and the students were wondering if there is a way to see the java that goes into each block. (Essentially a translator?) So they can start to see the language and understand how it works in the system.

Any way to make this happen? It would be a great learning tool for beginners.


Microsoft MakeCode allows you to code with Blockly and JavaScript and switch from one to another at any time.
It tries to use the available blocks, or uses blocks with JavaScript code.
A simulator is also integrated.

1 Like

Thanks, @Daniel_Pers I saw that on your previous example and it looks interesting. I think it will be especially helpful in testing ideas as I may be shifting to robotics next year at the Middle Schools level. I will be playing with that some more, and the moving parts functions that create some of your examples on CoSpaces as well.

1 Like

Hi Brian,

the idea is interesting and it makes sense at first. However, there are some issues.

The generated JavaScript code is quite unreadable for a beginner and it’s also not meant to be read. It is generated in a way and wrapped in a certain data structure so that it’s representing the synchronous Blockly code written by the user. This is not how anyone would write code in JavaScript and it would definitely not help any beginner to understand it.

That being said, I’m not sure if learning JavaScript from arbitrary generated Blockly code (any platform) is the right way to do it.

1 Like

I wasn’t sure how the blocks would translate, but that makes sense. I just recall seeing it a lot with the activities, but those being predeveloped for a “correct sequence” means they already know what the java should actually look like and thus make the shift.

Thank you for explaining it though.