Updated the LaserGame Squeak tutorial

Posted by steve | Smalltalk | Sunday 18 October 2009 2:08 pm

I continue to receive emails from students new to learning programing, object oriented development, Smalltalk and Squeak, as they go through my tutorial LaserGame.

Recently I was reminded again that I misunderstood my target audience when I wrote that tutorial.  My original goal was that this would be a process showing development through-to-completion of a delivered application all written in Squeak using Test Drive Development and generally sound everyday development practices.  And I thought the tutorial would be utilized by students having already learned the basics.  That turned out to be way off base.  I get letters all the time from complete newbies telling me thank you.

And earlier this week I was asked by one of these less experienced students about how I did what I thought was a very basic step in the process.  But of course, someone new wouldn’t know that.  My mistake.  So I just published another update with a clarification in that section.  I’m so grateful for the positive feedback that I get.

Here’s the updated page: http://squeak.preeminent.org/tut2007/html/038.html

I’ve made a lot of noise about doing a complete rewrite of the tutorial, in the past.  Yes, I have not completed that work.  First there were health concerns interrupting my work, then some health issues within the family.  Lately it’s just been too many other projects.  It’s amazing that I was able to carve out a clean free-time space and create that tutorial in 2007 like I did.  I think the whole thing was written and published over 4 weekends during that summer.

When I get back to the project I have several new goals in mind.  First off the tutorial will account for the inexperienced motivated student.  I’ll have more detailed notes and examples.  I’ve already started rewriting much of those parts.  I’m also uncomfortable that I gloss over some design considerations in a few places and want to amplify upon that work.  I’m also intending to make the tutorial available in book form, probably through LuLu.com.  Two other goals are worth mentioning.  I intend to have a version of the tutorial support the new dialect of Squeak called Pharo.  That actually complicates things considerably since the tutorial relies heavily on screenshots and the two dialect look so different.  I’m guessing I’ll have to create some of the Morphic objects that LaserGame uses but do not exist in Pharo too.  Lastly, I think the tutorial could easily be extended to take the student as far as making Laser Game an iPhone app.  That would increase the audience for Smalltalk development too.



  1. Comment by Mark Hamstra — October 21, 2009 @ 11:03 am


    Just to let you know, I’m fairly new to Smalltalk and have been working through your laser game tutorial using a recent Pharo image. The software installation and project setup stuff doesn’t translate over well, but after that it is pretty smooth sailing until you add the LedMorph in Section 4. With the Pharo guys having pared down and broken up Morphic, LedMorph isn’t in the Pharo distribution anymore.

  2. Comment by steve — October 21, 2009 @ 9:11 pm


    You are absolutely correct. The LEDMorph is absent from Pharo. I spotted this error when I tried to import the Laser Game package to Pharo.

    The good news is that I intend to fix that problem in the next generation write-up of the tutorial, actually having the student create a new LED Morph. That could be quite a bit of fun and a useful exercise. The bad news is that it’s a pretty far distance off for when the rewrite is completed.

    I’m not sure but I think you could export the morph from Squeak and port it directly to Pharo. It’s a possible interim solution.

    – Steve

  3. Comment by Mark Hamstra — October 22, 2009 @ 11:28 am

    The simplest solution is just to install the LED package from the http://www.squeaksource.com/PharoMorphicExtras repository. That allows the student to proceed up to the point where ObjectTools and PaintBoxMorph are used to create the laser beam drawing. PaintBoxMorph is in the basic Pharo image, but either I don’t understand how to instantiate it properly, or it is broken, since PaintBoxMorph class>>new keeps failing for me with Prototype = nil.

    Anyway, in order to proceed I just did the drawing of the laser beam over in Squeak and then loaded the resulting drawLaserBeamForm into my Pharo image. I haven’t had time to go much further then that, but I can continue to let you know where the trouble spots are as I proceed.

  4. Comment by Mark Hamstra — October 22, 2009 @ 11:42 am

    Oh, and while I’m at it, I believe you’ve got errors in http://squeak.preeminent.org/tut2007/html/145.html and http://squeak.preeminent.org/tut2007/html/146.html

    Specifically, the line “list includesKey: pt” in unusedRandomLocationIn:forGrid: should be “list at: pt” (as the code stands, the result is an infinite loop since emptyRandomLocationsFor: put a key-value pair in dict/list for every location in the grid), and you’ve wiped-out the “cell” local variable in renderContents for mirror cells and target cells.

  5. Comment by steve — October 22, 2009 @ 4:07 pm

    I just looked at the code for #unusedRandomLocationIn:forGrid and I have no idea where the version published in the tutorial came from. I went through the saved intermediate change sets and saw where the method was introduced and it was never coded like the method shown.

    Thanks for catching this. I will update the tutorial with a correction right away.

    As far as your comments about the wiping out the “cell” local variable in the mirror and target renderer methods, I don’t follow you. According to my intermediate saved copies of the Monticello packages the code is supposed to look like it does on page 146 of the tutorial. I don’t think that’s incorrect. Both methods use a getter method to access the cell.

  6. Comment by Mark Hamstra — October 22, 2009 @ 6:08 pm

    Ah, my mistake on the cell getter method — I missed it by moving too quickly through the page where it was defined (http://squeak.preeminent.org/tut2007/html/115.html). Sorry.

  7. Comment by Mark Hamstra — October 22, 2009 @ 6:13 pm

    Nope. Actually, I just had “cell isLeft” and “cell isOn” from the prior versions of renderContents instead of “self cell isLeft” and “self cell isOn”. Ah, the embarrassments of being a Smalltalk newbie.

  8. Comment by faxless payday loans — November 11, 2009 @ 1:44 pm

    Just wanted to say thanks for this.

  9. Comment by Spyware Blockers — November 12, 2009 @ 11:28 am

    I have been reading your posts lately, just want to say thanks for all informative stuff i have found here, helped me learn alot lately.

    Much Regards, Mark

  10. Comment by pay day loans — November 15, 2009 @ 6:30 am

    Like your writing! Still you can do some things to improve it.

  11. Comment by nintendost — November 17, 2009 @ 5:08 am

    Article very interesting, I will necessarily add it in the selected works and I will visit this site

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.