I went along to the CoderDojo at The Institute again this morning after the fun I had last week. I was better prepared: I'd found a handy set of tutorials in javascript the evening before, clipped some simple code examples into a word file and printed it out. Then I'd fallen asleep into my dinner (it had been a long week) before I'd had any chance to see how js (that's what us javascript mavens call it) syntax differed from perl, a programming language of which I have some experience. So I was not much better prepared.
I gave myself a roving brief and spent some time in the Scratch room drag-and-dropping code fragments with the tinies and some next door with the keyboard coders. As last week, it was a pretty good learning experience because I knew virtually nuttin' but was prepared to have a plunge at what might work. First hand up was a little chap in the front row who couldn't start because he didn't know where Scratch was hiding in the operating system, so I turned to the 8 yo girl at the seat next door and asked her and she showed us how to type "scr" into the search box. That was great, that's how I learned perl 12 years ago. I had just started in a lab that spoke perl almost exclusively. I didn't know anything: either about perl or about the work we were doing with perl so I asked the (bit older that 8 yo) girl at the seat next door and she was very helpful. Lesson 1. Ask the girl next door.
After a few weeks, I was the class whizz at making pictures with perl and GD because I'd robbed some picture-making code from my helpful neighbour and modified it and tweaked it and experimented with it until it would do my bidding. Lesson 2. When you have robbed some code, try changing it and see what happens.
And it was Lesson 2 that I concentrated on when I was next door with the javascripters. Not exclusively, mind, I also had to push the gospel (this will change your life) according to ctrl-C and ctrl-V. The assigned task was to design a web page with a handful of clickable buttons, each of which would reveal a different picture. As before that meant typing in a bunch of code (40 lines this week rather than 120, so that was an improvement) and then running it to see what happened. That took a while and there were lots of typos to correct, but eventually a number of working programs emerged. I took it upon myself to point to a section of their code and suggest changing it:
<img src="gandalf.jpg"
height="320" width="160">
* what happens if you change 320 to 160
* what will happen if you write: height="160" width="320"
* what happens if you have it: hieght="320" width="160"
* what about: <mage src="gandalf.jpg"
Soon enough everyone knew what was an internal variable, which was an external variable (the red code only works if there is a file called gandalf.jpg outside of the code you've just written), and which is essential syntax - what some languages call 'reserved words' - that will generate an error message. Of course, none of the kids knew the terms (reserved words etc) but they had a sound idea of the principles.
150 minutes passes real quick when you're having fun. We've been told that today was the last session before The Institute closes for the summer. So I'll have time to learn a little bit more, and bring something useful to the table.
Another super post! Really enjoying these updates from the sessions.
ReplyDelete