JoC #24: Smoke and mirrors

      The ideals which have lighted me on my way and time after time given me new 
      courage to face life cheerfully, have been Truth, Goodness, and Beauty. . . . The 
      ordinary objects of human endeavour — property, outward success, luxury — have
      always seemed to me contemptible.
            — Albert Einstein

One more quick one about image effects: a smoke effect to be precise. I’ll show you how to create this really cool effect just with what you know already. Hopefully, this will give you some ideas of more cool effects that you can do on your own.

Download video

Concepts discussedimage manipulation, visual effects, animation

Download: The project can be downloaded from the Greenfoot book website.

 

JoC #23: Animating the image

      A positive attitude may not solve all your problems,
      but it will annoy enough people to make it worth the effort.
            — attributed to Herman Oliver Albright

A last little bit before we leave our coloured circles behind: an animation. In this case, it’s a very simple one: fading out the circles. But it shows an important technique: The appearance of an actor can change all the time, if we want to. This is the basis for many visual effects.

And, we finally see an if-statement with an else clause! I can’t believe that it took this long for this to pop up.

Download video

Concepts discussedtransparency, dynamically changing images, if-statement


JoC, Teacher Commentary 22: Tracing control flow

      Mathematicians are like Frenchmen: whatever you say to them they translate
      into their own language and forthwith it is something entirely different.
            — Goethe, Maximen und Reflexionen

Tracing control flow (either through control structures, such as if-statements or loops) or through method calls, is hard for beginners.

This episode shows you how to use the debugger to make this clearer.

Download video

Concepts discussedcontrol flow, tracing, breakpoints, debugger

JoC #22: Refactoring for good style

      We are accustomed to see men deride what they do not understand, and snarl
      at the good and beautiful because it lies beyond their sympathies.
            — Goethe

Okay, time to get a little more professional again: Let’s clean up our code a little.

Writing in good style is really important, so today I’ll show you a bit about refactoring. Especially, we want to create short, clear methods. (The technical term for it is cohesion – we want highly cohesive methods.)

Download video

Concepts discussed: methods, refactoring, style, cohesion

JoC #21: Image manipulation – take two

      For every action, there is an equal and opposite criticism.
             — Steven Wright

We’re getting a bit further into image manipulation. I’ll show you how an actor can change appearance by dynamically changing its image while the program is running.

Download video

Concepts discussedimage manipulation, random numbers

Downloads: bounce.zip  bounce-v1.zip

JoC #20: Image manipulation – first contact

      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.

Download video

Concepts discussedimage manipulation


JoC #19: Class methods vs instance methods

      If can keep your head when all about you are losing theirs it’s just possible
      you haven’t grasped the situation.
            — Jean Kerr

Today, we’ve got some background stuff to discuss. Not much happening in terms of new functionality to our project, but important (and, no doubt, incredibly interesting) conceptual information.

Why is there sometimes a classname before a method call and sometimes a variable?

I’m sure all of us have had sleepless nights where we’ve been lying awake pondering this question. Today, it shall be answered!

Download video

Even if you’re not that interested in discussion of underlying concepts, but just want to GET STUFF DONE — still, watch this video. You can only become a good programmer (and get stuff done) if you understand what you’re doing.

I really want you not only to copy what I’m showing you, but become able to invent and create your own programs. For this, it’s important to get the concepts.

So, hit start, sit back for a few minutes, and learn something!

Concepts discussed: internal method calls, external method calls, static methods, instance methods 

JoC #18: Bouncy balls with mouse input

    If you have passion and focus, you can achieve things that amaze yourself.

And we’re back! I hope you used your couple of weeks space between Joy of Code episodes to catch up and get a bit of practice with Greenfoot — and now we’re off again.

This time, we’re talking about dealing with mouse input. Very important for many games and other interactive programs.

Download video

Concepts discussed: world act method, reacting to mouse input

A quick update

I know that some of you are waiting for the next Joy of Code episode. We are a having a little pause.

Just a quick note to reassure you: I have not stopped — there is more to come!

I am at a conference in the US (SIGCSE, in case you’re interested), and I have been travelling for over a week now. I will be on the road a little longer.

But the Joy of Code will continue when I’m back, in a week or so. Until then: Play with Greenfoot! Program! Enjoy!

Java 6 End-Of-Life shifted to November

This is possibly a case of

      Warning: Dates in your diary might be closer than they appear.

Oracle just announced that the “EOL date” for Java 6 has been shifted back. From July to November. While it is undoubtedly a relief for many that Java 6 has an additional four month of life left (for many of those few at least, who are aware of this at all) it still means one thing: End of life for Java 6 is in November! 2012!

Yes, that means this year. You didn’t know that, did you?

Now, this doesn’t mean that Java 6 will topple over dead on 1st November. It will, of course, continue to work for some time. But it does mean that Oracle will stop issuing updates and releases after that date for free. (You can still buy support from Oracle, but that will really only be an option for large businesses.)

So, while this will come as somewhat of a shock to some, it this too soon? That depends how you view it. Java 7 has been in full public release since July 2011, so it will be well over a year of the next major version being on the market by the time Java 6 bites the dust. Time enough for most to update?

Let’s look at where people really are. Here is the distribution of Java versions of users of BlueJ:

Java versions

BlueJ users by Java version

This shows us: Java 7 is currently used by just under a third of BlueJ users. (For Greenfoot, this number is a little lower than this.) About 3% still use Java 5.

So, while Java 7 has been out for a while, Java 6 is still by far the dominant version. The reality is: Many universities and schools update only infrequently, and updates to Java 7 haven’t happened yet in many places.

We would hope that this changes over summer: many educational institutions upgrade their lab software over the norther hemisphere summer break, so that might give a good boost to Java 7 before November.

But will most of the Java 6 installations disappear by then? Most likely not. Especially on Mac OS, it’s difficult: Java 7 isn’t even in public release for that platform yet.

So, if you’re responsible for Java on your institution’s machines: time to think about moving on!