MWRC: James Edward Gray, II

James Edward Gray, II

If you want to learn Ruby you should read code, lots of code. He estimates that an 'expert' ruby programmer would read more code than he writes.

Examples of good code libraries

Restclient

  • clean interface to restful services
  • this is networking code done right
  • quote he likes: 'Everything in a method should be written to the same level of abstraction'
  • logs from restclient are executable ruby code

bj

background priority queue for rails

terminator

robust thread/pipe/etc level code written by an expert

slave

trivial multiprocessing with built-in ipc

The art of code reading

  • when you start reading, relax. not all code sucks & you probably won't understand the author's reasons at first
  • don't start with Rails (too big & complex)
  • have a goal
  • get the source code open in your standard text editor (e.g. use gem unpack or get a copy from a vcs)