Why Learning to Code Doesn’t Suck Anymore

Learning to code image.PNG

Coding has always been notoriously difficult to learn and to understand. For the longest time, coding looked something like this.

Coding simulator gif.gif
Now that’s just some gibberish code created using http://hackertyper.net/ (try it out, great practical joke) but most of us wouldn’t know whether it was or wasn’t.

The reason that learning coding has been so difficult for so long is that you were actually trying to learn two things simultaneously.

  • The Logic of Coding
  • The Syntax of Coding

I’m actually mildly amazed that anybody ever managed to learn the Logic of coding while also navigating the unforgiving Syntax of Coding.

  • Should it be {curly brackets}, (round brackets) or [square brackets]?
  • Should I use a semicolon ; or a colon : ?
  • Is it a forward slash / or a backslash \ ?

A REVOLUTION
Fortunately, we can now decouple the logic from the syntax and start learning coding in a far more organic way. There are other program that do this but Scratch is the most popular and it’s what I use.

Take a look at this “coding” that I’m doing.
Recording #215.gif

So what we end up with is code, or put simply, instructions, that look like this.

simple code

 

So when the green flag gets clicked, Something will point in direction -90, wait 1 second, move 30 steps, wait 1 more second, then point in direction 90.

I still don’t know what that looks like, but it’s easy to read. Lets run our program and see how it looks.

Cat moving.gif

  • So the green flag gets click,
  • then the cat points left (that must be what -90 means)
  • Then he waits 1 second
  • Then he moves over a bit (doesn’t seem very far, but it must be “30 steps”)
  • Then he waits again
  • Then he points right (that must be 90)

This is what learning to code is today. No brackets or backslashes or horrible error messages.

Immediate Feedback
Here I’m learning only the LOGIC of code and getting instant feedback on whether my logic is correct. Either it works the way I intended or it doesn’t. This is high quality feedback, the kind that real learning depends upon.

But why teach coding?
I’ll let you in on a little secret. Computers are breathtakingly stupid.

A computer will only do exactly what you tell it to do. Nothing more and nothing less. Breaking a problem into a series of steps that a computer can understand and execute requires clarity of thought and communication.

An algorithm written by a human to instruct a computer to  do something beyond human capabilities is a thing of beauty.

Binomial-Gif
A coin flipping algorithm allows this cat to flip 6 coins 100s of times in a few seconds and plot their relative frequencies on this polygon.

 

 

 

 

Hexagon drawer.gifWhat we’re looking at here is an iterative program allowing 100s of hexagons of increasing size and changing colour to be drawn in moments. It is art from the mind of a human but only made possible by the power of a machine.
3 little pigs gif.gif

 

A classic story being acted out with the help of a few sprites and a few lines of computer code.

 

 

 

 

In Summary
Coding is not what you remember it to be. It doesn’t suck anymore.

 

 

 

 

 

 

 

More fun with scratch

In a previous post I talked about Learning Math through Coding “Auto-Solvers”

This can be done across the curriculum in a whole variety of ways. I’ll talk about that in another post.

Here’s another go at coding with Scratch.
Binomial-Gif.gif

This was all made using https://scratch.mit.edu It’s a fantastic little program to get started with programming without knowing how to code. Anybody can use it.

Anyway, this is my little demo of the binomial distribution. There’s plenty out there online. But this one is mine.

You can see how it was made here. https://scratch.mit.edu/projects/103731070/ You can even jump inside the code and see how it all works.

If you haven’t tried coding yet, don’t worry, you will. The future for most teachers probably has some coding in it somewhere.

 

Learning Math Through Coding “Auto-Solvers”

For a very long time now, I’ve been fascinated by the idea that computers can do maths. Not just a little bit of maths, but lots of maths and really fast.

I remember as a 7-year-old typing 2 x 2 into my calculator and then pressing equals.
=4
=8
=16
=32, 64, 128, 256..
As fast as my little finger could press that equals button the powers of two (I didn’t know they were called that yet) kept on coming. What an incredible device. How did it do things so fast?

In high school, I remember using Microsoft excel for the first time. Now things were even more amazing. I could create sheets like below with the simple drag of my mouse.

excel-square-number-gif

Not only that, but I could create excel sheets that automatically calculated pretty much anything I wanted to calculate!

All I needed to know was the formula required and away I went. I made what I liked to call “Auto-Solvers”. Auto rectangular prism solvers, Auto simultaneous equation solvers, Auto home loan repayment solvers. Anything could be automated with my buddy excel.

But as a teacher now, there is a problem. These Auto-Solvers are everywhere on the web and freely available.

“Sir, why would I need to learn how to solve simultaneous equations, when a website like wolfram alpha can do it better and faster than I can?”

I need to make them realise that somebody, somewhere created that website. Maybe they could create something too! Right up there at the pointy end of Blooms Taxonomy, CREATE!
fx_Bloom_New
So here’s my first idea. I’ll present them with my latest creation…

Space Pythagoras Hypotenuse Auto-Solver
pythagoras-solver-gif

This is an auto-solver that solves for the hypotenuse of any right angle triangle you can throw at it. Test it for yourself here.

Now if you look to the right of that gif you’ll see little lego-style coding blocks. Those are the simple coding language used by Scratch 2.0.

I’m hoping that when I share this with my grade 10 class, they will be able to alter that code slightly to create a different Auto-Solver…

Space Pythagoras Shorter Side Solver.

I’m excited about embedding coding into my mathematics class, and I think by giving them a simple template to work with, I can ease them into it without losing too much time to explicit coding instruction.

How about anybody else out there, anybody embedding coding into their mathematics class?