Category Archives: JavaScript

Hack Your Life!

tdLearning to Code is all the rage right now, but how to implement a coding for all programme is not as easy as it sounds. There are a number of decisions which need to be taken. The first decision is around whether it will be merely open to all, or compulsory for all. At my school we expose all the students to a little bit of coding in their computer skills classes, in the form of some Scratch and some JavaScript. I also do a Game Design unit using Flash, with a little bit of Action Script. It works in that everyone can meet the requirements, but not all students embrace coding enthusiastically, so there might be a great deal to say for going the extra-curricular route, or maybe both.

I suspect that both is the right answer for most contexts. Everyone needs to be exposed to some coding, but I’m not convinced everyone can handle a full-on programme. the second decision is what programming language to use.

I started teaching some coding back in the late 1990s, with some Logo, and then quickly moved to JavaScript. The big advantage of JavaScript is that you do not need a compiler. All you need is a browser and a web editor. Currently I get my grade 9s to use JavaScript to create a quiz which will tell the user if they are right or wrong, and tally a score. When they create Flash games, I teach them to use AS3 to create drag and drops, and how to use tutorials to learn more skills. However, with many new interfaces for creating mobile apps appearing, my gut feeling is that this is the way to go, and I am probably going this route this year. MIT has a platform for creating apps, but there are so many popping up, I haven’t been able to research them all.

Here’s the introductory video for the MIT App platform to give you an idea of how it works.

The third decision is around how to build enthusiasm. Some students will enter into it with gusto and there is so much available online that they will be able to teach themselves. But getting the social aspect to work is vital to any programme having staying power. If you can meet face to face that is the best option, but in many schools the normal sporting and extra-curricular programme is so full, finding a mutually agreeable time is well-nigh impossible. I have tried running a virtual club, but the buy-in is limited. Special programmes which run for a limited period of time, such as a Hackathon or Hack Off may work better if you can find a niche in the calendar. I have been trying to shoe-horn some coding time into whole school programmes such as Cross-curricular tasks, or end of year programmes when teachers are marking exams and willing to sacrifice curriculum time, but for some reason staff meetings tend to resist the idea as soon as you mention coding, or even worse, hacking. For students the word hacking has a much more positive valency, however.

I honestly don’t know what the answer is, to all three questions, but I do sense that this year the zeitgeist is different. The idea that everyone should code is so out there, I think it may just take hold!




Scratch IT!

sratchOne of the questions I ask myself every year is what kind of introduction to coding I can usefully give my grade 8 and 9 students. I have used both JavaScript and ActionScript at various times. This week the IT teacher taught my class to use Scratch, and the students produced a simple Pong style game in an hour lesson. The motivation behind this guest appearance was the desire to grow the number of students electing to take IT as a subject to Matric. Scratch is a free program which uses a visual interface to set up conditionals, loops and all those programming things that depend on pesky indents or braces in programming languages such as Java, very off-putting for students! The results are displayed in a preview window, and do not require compiling! Again, a big plus for beginners.

There is a huge debate amongst IT teachers about the usefulness of Scratch as an introduction to programming, many seeing it as a waste of time they could be using to get straight into Java. Others praise it!

I watched the lesson from the back of the classroom, and was impressed by what I saw: students engaged in creating the game and exploring the application beyond the instructions given. Coding games, is, I believe the way to go. No-one really wants to code tax return programs, and games tend to provide an enormous sense of satisfaction. Gosh – did I do that!?

Snapshot 1 (2013-07-12 12-58 PM)I used Scratch for he first time last year as part of an online course on and found it tremendous fun. I am not sure about how it stacks up as a tool for programming students, but for a general class, with no interest in programming, it really seemed to old their attention, and the results were pretty good.

I believe all students should have some exposure to programming. We live in a world were coding is embedded in the very air we breathe and it is extremely dangerous to allow a situation where we become dependent as a species on something we cannot at the very least tweak! I also think it helps develop thinking skills. There is something precise and unforgiving about computer programming. It permits no margin for woolliness and demands the highest standards of precision and accuracy from students. Gratification is delayed, and I believe this is also a very useful lesson students sometimes don’t learn often enough in this day and age! It teaches the value of persistence as well, and, again, students tend to give up far too easily when tasks become difficult.

On this exposure to Scratch, I have to say that it seems about the best introduction to programming for a general class that I have come across.


Learning to Code – Python is fun!

My enthusiasm for computers began in the early 1980s with an Apple machine and a language called Super Pilot, which I learned as part of my teacher training. I went on to play around with BASIC and a ZX Spectrum, before work and life got in the way. I never really developed that early interest in programming until I started teaching JavaScript to my computer literacy classes back in the early 2000s. I had trained as an English and History teacher but drifted into teaching computer applications because I was able to use a computer, and the rest of the staff were pretty clueless. From the beginning, though, I didn’t want to teach only Word, Excel and Access – I wanted my students to have some exposure to coding.

To my mind JavaScript was perfect. It ran in a browser so you didn’t have to spend the fist few lessons worrying about compilers and such, and you could quite quickly introduce key programming principles: comments, declaring variables, for loops, and so on. My own skills though were pretty basic – just a little above my students’!

aseroidOver the last year or so there has been an explosion of interest in learning to code, and so I decided to develop my skills more formally by doing a course on Python on Coursera. The course was offered by Rice, and consisted of lectures, quizzes and mini-projects developing simple games in Python, building up to an asteroid game in week 8! Student code was evaluated by peers, and the pace was relentless, with deadlines every Sunday! The coding was hard for relative novices like me, unfamiliar with Object Oriented Programming, but not too hard, and I think the staff managed to get the right balance. I managed to get all the projects out, sometimes not quite perfectly, when pressures of time got too much, but I always felt I could do it.

The peer evaluation worked well, and fostered a sense of collegiality. The Discussion Forums were very useful for posting queries and getting help when you got stuck. Sometimes perhaps a bit too much code was posted, but in terms of learning, it was very helpful to share ideas and see how others were approaching the problem.

The course also used a great tool – codeskulptor – which allowed you to code, and run your code inside a browser. It also allowed you to assess other students’ code easily. All-in-all there was a real sense of a community and a class, despite the purely online format and size of the course.

In my own classes I have been using game-creation as a tool as well, teaching my grade 10s to use basic ActionScript to create Flash games. This has worked well, and the quality of games has risen this year. However, I am looking for new ways to increase the coding content expected of my classes – none of which are programming classes. Having completed this Python course, I am considering designing a short high school Python course, based on game design. By providing partially coded templates it should be more accessible, and some of the basics could be introduced fairly painlessly.

If my students get half the buzz I got out of Python then they’ll be hooked for life!


Teaching Kids To Hack!

Ever since Google CEO Eric Schmidt’s speech last year in which he foregrounded the need for more computer programming in schools, there has been a mushrooming of initiatives around coding for kids. As an ICT Teacher, this is something I have thought long and hard about over the years.

Back in the 1990s I used Logo quite a bit, and it was fun, but both the students, and I found it limiting. So I started introducing JavaScript. Because it works in the browser, and you do not need a compiler, students can start coding right away. I start with a little html and then jump in with some JavaScript, getting my students to code a simple web page calculator which inputs two numbers and then adds, subtracts, multiples and divides the numbers. I use tutorialised content and whole-class, step-by-step instruction. Bearing in mind that this is a general class, not students taking IT as a subject, this is sometimes too much for a few students, and they struggle to complete even this, heavily guided task.

I then ask the students to use what they have learned to design a more complicated calculator, such as a web page which can do multiple conversions: such as kilometers to miles, kilograms to pounds, and so on, or to engage in their own project. A significant group of students clearly relishes this challenge, and every web page greets one with fun applications such as personalised greetings, web pages that change background colour depending on one’s favourite colour, and so on.

I think JavaScript works quite well as a general introduction to programming. It is relatively easy to learn, has a great deal of support and tutorialised content on the Internet, such as Codecademy so students can take it further and doesn’t need compilers which need to be configured. It also allows students to learn enough to be able to tweak downloadable JavaScript code for their websites.

You will lose a certain number of students with JavaScript, however, because it is not visual, and requires accuracy and debugging. It is very dry to learn. For any students who start switching off, it is important to give enough help and support to enable them to at least complete a simple project, and give plenty of opportunity to add visual elements using the design view of programs like Dreamweaver. For this reason I get students to do their JavaScript coding in the code tab of Dreamweaver. This seems to work well.

Leave a comment

Posted by on July 21, 2012 in Coding For Kids, JavaScript

%d bloggers like this: