Friday, September 21, 2007

squeak by example: new book

Squeak by Example is just what I needed as a guide to learn smalltalk/squeak programming language

I've learnt some new stuff (mainly for beginners)

Red button, yellow button, blue button: From the first chapter I learnt that you can easily reconfigure your mouse buttons so that now they are more compatible with the conventional Windows GUI. Now I have:
  • left button (red button) displays the World menu
  • right button (yellow button) displays a context menu
  • middle button (blue button) displays the morphic halo
I've learnt how to maintain multiple images, eg. so I have one image named SBE in which I can develop the projects from the book and another image named Squeak3.9 which I can use to start something fresh

I've built a game called Quinto and eventually got it working! That's a big step because initially my goal was to develop the Africa map game (already developed using GameMaker) in squeak

The game involves clicking with the mouse which puts a pattern of coloured cells (click once produces blue, click again produces yellow) on the board. The aim is to maximise the blue cells which is tricky because of the way the pattern produced by a click overlaps.

I already knew something about making subclasses, methods, testing as you make and inspecting objects from earlier exercises. But I learnt new stuff about organising methods into categories (called protocols) and using the debugger.

Then I learnt that you could file out just the code for the game and then file in to another image (or send that game file off to a friend)

Initially my game didn't work properly so I joined the beginners squeak list and asked some questions - and received a couple of helpful replies quickly. It turned out that the problem was that I was using version 3.8 rather than 3.9 recommended for the book. When I filed in my code into the 3.9 version the game worked properly straight away!

I've only read a couple of chapters of the book so far, but it's great. Everything is explained very clearly. There is a free online version but I've ordered a hard copy as well.

Many thanks to the authors: Andrew P. Black, Stéphane Ducasse, Oscar Nierstrasz, Damien Pollet with Damien Cassou and Marcus Denker

1 comment:

lucychili said...

Kim and I visited Bill this weekend to have a go at these and it was great fun.
We had success in programming the game but I was not much good at playing it =).
Thanks Bill