In a week when Apple continued to go thermonuclear against anything Google and Microsoft continued to steer Windows 8 astray, Google announces Blockly a visual programming language and computer programming learning tool. Here is a screenshot of Blockly in action:



The Blockly demo of a Maze solver is a wickedly tough programming task because users have available neither a test for success/end condition nor do they have any variables to use to mark the state of the Maze traversal. Have a go at this problem – the solution appears to use levels of logic to encapsulate the four states of each block.$100 to the first user who delivers in the comments a solution to the maze problem.

Equally interesting is the Code example where a more complete set of Blockly commands and syntax is available. What is interesting is the Blockly code can be instantly turned into JavaScript, Dart [Google’s new programming language], Python, or XML [but see the garrulous XML code – at least triple the size of any of the other 3 languages].

Here is a sample[Yes, Blockly has the look of Lego blocks snapped together, kids should love it]:



Above is the Blockly code

var message; var Alist; var x; message = 'This is Blockly in Action'; Alist = ['Start of Alist', 66, [message.length, Math.sin(90 / 180 * Math.PI), 'End of sublist']]; window.alert(message); for (var x_index in Alist) { x = Alist[x_index]; window.alert(x); } window.alert('Thats All Folks');

And if you click on the JavaScript tab here is the corresponding JavaScript code.

var message; var Alist; var x; main() { message = 'This is Blockly in Action'; Alist = ['Start of Alist', 66, [message.length, Math.sin(90 / 180 * Math.PI), 'End of sublist']]; print(message); for (var x_index in Alist) { x = Alist[x_index]; print(x); } print('Thats All Folks'); }

And if you click on the Dart tab above is the corresponding Dart code.

message = None Alist = None x = None import math message = 'This is Blockly in Action' Alist = ['Start of Alist', 66, [len(message), math.sin(90 / 180 * Math.PI), 'End of sublist']] print message for x in Alist: print x print 'Thats All Folks'

And if you click on the Python tab above is the corresponding Python code.

If you read the Blockly Wiki, Google appears to have ambitious plans for developing Blockly. And of course its Open Source under the Apache License – you can get the source at Github.

Summary

Now I am no Google illusionist, I know that Google can be as driven as evidenced by their privacy-flaunting Street mapping crews and the low rates they pay for Adsense Display ads. But Blockly is refreshing – a reminder that Google still manages to have a modicum of coding fun in the midst of a thermonuclear war with Apple and friends.