I’m attending the third annual Mountain West Ruby Conference in Salt Lake
City. Since my notes may not represent the speakers accurately, it may be
wise to read the summaries of the presentations over at the
over at the [web site](http://mtnwestrubyconf.org/2009/speakers). I’m taking notes for each of the speakers, and I’ll prefix the title of each blog post with “mwrc”.
Code Reading by James Edward Gray II
Little Big Planet: A cool PS3 game that people have created levels for. It’s interesting to see the code that shows how people create levels.
Why is code reading important?
– Shows common idioms
– Get better at working on other’s code
– Understand how something works
– Understand limitations
– Seeing bad code helps you write better code
– Always need more ideas
rest_client: Networking code done right
You can tell from the structure that it’s clean code. He showed us the ugliest parts of the code, and it looked clean.
Restful-shell: IOD shell
If you create a log file, it’s executable code that you can then edit and enhance.
He created the Towers of Hanoi for LittleBigPlanet. He had to redesign the playing interface serveral times to get it to fit into the game correctly.
Sometimes users want to work using indexes of columns. Other times, they want to work with column names. Sometimes, column names repeat.
This library was one of the first users of the new Ruby m17n libraries, and he found a lot of bugs at that time.
BJ, Slave, Terminator: Ruby libraries to build multiprocessing UNIX software. Built to be very robust.
– Terminator is better than Ruby’s timeout handlers. “plot_to_kill pid”
– BJ – robust background priority queue for Rails. Notices changes from outside world via signals.
– Slave – multiprocessing with built in IPC. Heartbeat.
### The Art of Code Reading
– Take a deep breath and relax
– Not all code sucks
– Don’t start with Rails. There’s a ton of great stuff in there, but it’s really complex and hard to follow.
– Have a goal. “How does it do that?”
– gem unpack
– Start with the tests
– Check for “examples”
– Try irb: irb -r