Krista's Coding Corner

03.02.2013

What would be the easiest way to learn coding?

I can still remember how my first real encountering with code was Java, and I just didn't get it. I spend hours and hours with it, and still I didn't understand even the basic structures of it. Meaning for example: in which order the computer does things, how to run functions that are in other object's stomach (Java is object oriented coding) and so on.

My current opinion is that with people like me -who are quite hands on / aren't too abstract with their thinking- the clearest way would be through a concrete application. I'm not meaning web-applications or other visual things on screen but real world machines. Something that does something physical if you give it a command. Like arm robots (they are actually more like manipulators).

If you have ever played with arm robots you know that you (mostly) give them points in some coordinate system where they are supposed to go. And a robot can learn those points just by you showing it that "ok, robot, now you are in place A, remember this place". Then you can move the robot elsewhere and it can return to that point A by a command. With a robot it is easy to see cause and effect in action.

Variables initializing is quite same thing as showing an arm robot some points and giving those points a name. Let's imagine that you teach the robot four (4) points that create a square. Each point has a name, in this manner:

In your code you can write:

  • Go to point A
  • Go to point B
  • Go to point C
  • Go to point D
  • Go to point A

And the robot "draws" a square with its route.

Then you can leave one point out:

  • Go to point A
  • Go to point B
  • Go to point C
  • Go to point D
  • Go to point A

And get a triangle :) Easy to see why it matters that in which order your lines are and what it means to lose one row, right?

To coders this is trivial but not for all those who are learning - even we all have already learnt that text (English) is to be read for left to right and up to down. This sort of teaching also makes understanding if-sentences, for-loops, function calls and so on easier. In my opinion.

PS. I wish I had a robot when I was little. <3

blog comments powered by Disqus