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 #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 #7: Lettuce is good for you!

      The person who knows HOW will always have a job, but the person
      who knows WHY will always be his/her boss.
          — Anonymous

Trying a different presentation style for a change (in an attempt to speed things up a bit), today we’ll do a quick run through first, followed by some explanation.

And what we’re doing is giving our turtle something to eat. Have a look.

Download video

Concepts discussed: creating a new class, if statement, collision detection, saving the world (yes, really.)

JoC #3: Classes and objects

    If a man writes a book, let him set down only what he knows.
    I have guesses enough of my own.

          — Goethe

Alright, now it finally starts getting interesting! After the previous talk about installation, now we’re getting started actually doing stuff.

Watch this episode to get the first feel for working with Greenfoot, and see what classes and objects are all about.

Download video

Concepts discussed: class, object, method, instance, return value, return type, void, int, boolean

And, as I said in the video: Follow @JoyOfCode on Twitter to get updates when new episodes are posted.

Scenario download for this episode: hedgehogs.zip      (save and unzip before opening)