If life gives you lemons – keep them. Because, hey. Free lemons. — Anonymous
In this episode, we’re continuing from the last episode’s theme and investigate and compare an alternative structure for making our Ball and Counter objects cooperate. We also have a first brief look at casting.
Recognising alternatives is a good skill, and it slowly eases us into discussions about code quality, which we will get to in more detail later.
Daring ideas are like chessmen moved forward; they may be beaten, but they may start a winning game. — Goethe
In this and the next episode, we’re looking a bit more into how to set up object structures, and how to get them to interact. This is one of the most fundamental concepts of object-oriented programming, so you need to get your head around this.
We discuss this here with the example of integrating our counter object into a scenario.
What is important in life is life, and not the result of life. — Goethe
Today, we’re starting to look a little more at images. We’re starting with something quite easy: manipulating (programmatically) the world background. But this introduces important concepts which we will use shortly to do much more with images.
Also, this is another nice example of object interaction (as we know by now: one of the most important concepts in object -oriented programming). In this case, the world object interacts with an image object.
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!
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.
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?