Using Shoes to Have Fun – Tim Elliott
Intro
He rode his bicycle from Chico. He works at Trevidia, and is a Rails developer
Links:
- The Shoes website – To get and learn about Shoes
- The Shoe Box – A collection of user apps written in Shoes
- Nobody Knows Shoes (comic book)
Shoes
The highlight is the fun that he has found by programming in Shoes. This was originally a talk about iPhone, but he wanted to put more fun into it.
why the lucky stiff wrote a comic about Shoes. In 2003, why wrote a blog post called “The Little Coder’s Predicament”. It is a call to arms for all programmers, beginning and expert, to have more fun.
Such as the old Commodore 64 program, written in BASIC:
10 PRINT “TIM RULES”
20 GOTO 10
You could do really fun things really easily, even if you didn’t own a C64!
However, Ruby is harder for kids (especially on windows) to get started with:
- Ruby one click installer
- RubyGems
-
Sqlite
rails cat_app
script/generate
etc…
That lets you “make a cat”, but not too exciting for kids. Involves too many other languages (HTML, CSS, Javascript). They want cats to jump around the screen and do cool stuff.
Shoes
- One installer
- draw and animate
Shoes is not a Gem
Couldn’t use a standard ruby distro, had to install a new one, but this is because shoes is not geared towards developers, but people who are installing for the first time.
Shoes is a GUI toolkit that embeds Ruby. It includes a packager and a few gems.
Very flexible but understandable layout engine.
Example of Shoes:
Shoes.app do
stack do
para 'wanna click a button?'
button('sure') { alert 'woot' }
end
end
“Stacks” and “Flows”. You can do simple or complex layouts using these two principles.
Flows act like left floated html elements.
Everything is wrapped in a Shoes.app block, and does a class eval.
You can put your own classes outside the app block and use them inside, but there’s a gotcha. Once you use classes from outside the app block, the class eval doesn’t work, but there is a workaround.
Shoes keeps an array in the form of an in-memory stack that remembers everything. So when you start putting controls in, Shoes knows where to put them. it is always tracking which container you are in, so you can get an idea of where everything shows up.
Also watch out for long-running tasks at the OS level, this can kill the app performance (due to green threads).
Demo of Shoes:
Drawing some ovals
Shoes itself comes with online documentation when you install it, which has a nice search tool and examples.
Shoes is also good for rapid prototyping, such as desktop apps or iPhone apps. The advantage is that you get to do it all in Ruby.
Sharing with friends
It is easy to share. If you are running shoes, you can use a packager that comes with it to create an executable installer which runs on Windows, Linux, or OSX.
It will be small, a few meg, and still under ten even if you use video.
You can use ruby-debug to interactively debug.
`Shoes.setup do
gem ‘ruby-debug’
end
require ‘ruby-debug’
Shoes.app do
debugger
end
`
Shoes has a gem installer gui and will install gems includes in the Shoes setup block, this gets included in the package.
It includes native HTTP download libraries for all platforms, because ruby http lib is slow and for other issues.
In the git distro, it includes “bloopsiphone” which lets you create Atari-like sounds and noises, and it also has an easy API.
Be creative and have fun, make robot apps, make the robots eat each other. This is a great way to connect your passion with non-programmers, because everyone likes robots eating other robots.
Q: You mentioned development for the iPhone can you go into more detail?
A: You can’t run ruby on the iPhone yet but its still useful for prototyping.
About the Author