Saturday, July 2, 2016

structure

<div id="theview"></div>

<div id="thecontrols"></div>

<a href="javascript:start()" style="position:absolute;top:30%;font-size:10em;color:greenyellow">start</a>

<script>

function start() {
setuptheworld()}

function setuptheworld() {
setupthecontrols()
setuptheview()}
</script>

<script src="setupthecontrols.js"></script>
<script src="setuptheview.js"></script>

The above is the whole of the code for a 3d vr game. You can see all of it at once because it's structured. setupthecontrols and setuptheview are complicated functions consisting of many instructions each, but all those instructions are packed into those two boxes on this page. So, looking at this page, you are looking at all those instructions.

If you want to look at the instructions in more detail, you can click the function calls. That's the way programming environments should work.

There are not, however, at this time any instructions to look at. Here's what's really cool: computers can run the above code, just as it is. If you run this code in a browser, you will see the start button, and, if you click it, the computer will run setupthecontrols and setuptheview. It will check them, and to do that, it will check for them. It will not find them, so it will say "Cute! Nothing there. I'll wait for further instructions." Nothing will break. Nothing bad will happen. The program will simply run.

This is designed to show that ... what? ... programming is fundamentally broadly purposed. People think you can't begin with a broad purpose - of course, in reality, that is the only way you can begin - that computers can't interpret a broad purpose ... How do you get from a broad purpose to specific instructions? Structure.