Sheep In Your Shoes : A Game
What?
-
A simple game for the Shoes GUI toolkit by Why The Lucky Stiff. See www.shoooes.net.
-
An educational aid for teaching programming concepts.
-
An illustration of object oriented programming principles: mapping the problem domain, encapsulation, modularity, interface.
-
A demo of modern 2D computer graphics and interactivity.
-
A testament of iterative, organic cultivating of the code toward it's better self
Why?
Because teaching programming concepts is hard.
When you have to teach basics of programming -- nota bene to humanities students -- things are sometimes too abstract. Particularly when you have to explain difference between various programming paradigms and why Object-Oriented Programming is (at least some) solution to „fragile code“.
The principles are laid out in the code of animals-oriented-on-objects.rb
file. But you cannot see them. And you are not sure why do you make those silly classes anyway.
Things can be seen much clearly in the game. You suddenly know why a sheep is an „object“ and why we say it has some properties (like position, maybe?) and some messages (like „Run, baby, run!“) can be sent to it.
You also know how to start writing code. You usually start with something. A simple-bounce.rb
file from samples included with Shoes in this case (see initial commit).
Then you gradually build up the environment of your game: you make the pasture green and put a sheep on it. You make the sheep move. You add more sheep and make them move. You add a dog, and make the dog catch the sheep. And so on. In the end you „refactor“ the syntax of the game, add documentation, things like that.
All of these steps are saved in Git repository tags 1 to 13, so you can easily do a git checkout 1
, git checkout 2
to see development of the code and walk through it slowly.
Shoes and Ruby make all of this very, very easy. Ruby is probably the best language for teaching programming, for beginners and advanced alike. And with Shoes, you can just see everything.
Setup
-
Download the Shoes platform from www.shoooes.net/downloads
-
Open the
sheep_in_your_shoes.rb
file in Shoes
Binaries (not necessary up-to-date)
Written by Karel Minarik (www.karmi.cz). Published under MIT license.