JoC #17: Bouncy coloured balls

      Debugging is twice as hard as writing the code in the first place.
      Therefore, if you write the code as cleverly as possible, you are,
      by definition, not smart enough to debug it.
            — Brian W. Kernighan.

We’re leaving the ‘Trick, the turtle’ scenario this week to make something new completely from scratch.

The main purpose here is to piece together everything we have seen to far about the structure of a class, and create a complete new class (with fields, constructors and methods).

Yes, I know, this doesn’t sound too exciting. I can see from the video view numbers that videos dealing with review of concepts aren’t quite as popular as the ones showing new stuff.

So: Don’t worry. I’ve thrown a few interesting new things in as well: dynamically changing images, string concatenation and multiple constructors are some of them. Oh yes, and a first run-in with a runtime exception!

Download video

Concepts discussedclass structure, field, constructor, method, default constructor, changing images


JoC #16: Adding a score counter

      Habe Mut, dich deines eigenen Verstandes zu bedienen.
            — Immanuel Kant

Welcome back after a little break in putting out new episodes.

I was at a conference for a week or so (Melbourne, other side of the world!), and then I had to get settled into my time zone again, but I’m back! I still feel a little jet-lagged, so if my voice sounds even more drab than usual in this episode – I blame the time zones.

This episode deals with an incredibly important concept: object interaction. (It could actually also have been titled “Object interaction – a second look”.) We started to look at object interaction a little bit in Episode #15, and now we’re really getting stuck in. We’re throwing around terms like “object references” and “constructors”.

Yes, we’re slowly cranking up to a more professional level here. So sit back, switch your brain on, and watch. And of course — as always — after watching: Fire up Greenfoot, and get coding yourself!

Download video

Oh, and one more thing: I am showing how to implement a score counter here, because several people have asked me how to do that. So if you have a question, or something you want explained: tell me in the comments, and I’ll try to fit it in in one of the future episodes.

Update: This episode shows how to use a ready-made counter object. If you are interested in making such a counter yourself, you can now look at Episode 26.

Concepts discussedobject interaction, constructor, field, local variable, assignment, external method call

Downloads:  trick-the-turtle-v4.zip

JoC #15: Object interaction (first encounter)

      The pure and simple truth is rarely pure and never simple.
            — Oscar Wilde

Today a long, and quite full episode. We encounter various very important concepts for the first time: local variables, class types and object interaction.

If you have questions left after watching this – don’t worry. We will look at all of this again in more detail in future episodes. And you can use the comments below to ask your questions (or make any other comments).

By the way, I just noticed I made a mistake. (Yes, that does happen!) There is a bug in the program that I’m writing in this episode. Can you spot it?

Download video

Concepts discussedvariable, field, local variable, assignment, class type, object interaction, external method call


JoC #14: A first look at variables

      I’m a great believer in luck, and I find the harder I work the more I have of it.
            — Thomas Jefferson

Let’s move on to another important concept: variables.

There’s a lot to say about variables, so we start with oner example: An int variable as a counter.

Download video

Concepts discussedvariable, field, int, ++


JoC #13: The structure of a class

      We know accurately only when we know little; with knowledge doubt increases.
            — Goethe

It’s time to pause a little bit with our code writing and analyse what we have so far. We want to make sure that we properly understand what’s going on.

So, today you’ll get a deeper understanding of code structure and – as a bonus – find out a bit about comments.

Download video

Concepts discussedclass structure, class header, comments

JoC, Teacher Commentary 10: Motivation and reflection

      You must be the change you wish to see in the world.
            — Mahatma Gandhi

After a few days’ pause, here’s another video. And it’s time for a teacher commentary again.

We’ve crammed in quite a bit of material over the last few episodes, and the question now is: Firstly, how do we keep motivation up? But more importantly, do the students actually understand what’s going on?

Some hints and tips what to look out for…

Download video

JoC #10: It’s done: Play the game!

      Times are bad. Children no longer obey their parents, and everyone is writing a book.
            — Marcus Tullius Cicero

And now we’re getting to the point where you can actually control the turtle and play your game.

Download video

You can download the scenario source (as it is at the end of this episode) below. If you do: unzip first, and then open.

Concepts discussedKeyboard control, code completion, String type

Scenario download:  trick-the-turtle-v3.zip

JoC #9: Snakes on a plane!

      Satisfaction lies in the effort, not in the attainment; full effort is full victory.
            — Mahatma Gandhi

Things are start to heat up in our scenario: Snakes are chasing Trick (the turtle) over the plane. (That’s, of course, ‘plane’ as in ‘flat bit of ground’, not as in ‘flying thing’).

Download video

Concepts discussedHmm, don’t know. Creating yet another class. Copy-and-paste coding – is that a concept?