Ruby Port of "Programming Collective Intelligence" comments

published 01 December 2007
filed under: ruby  

Thanks to a quick comment from Toby Seagaran, the author of "Programming Collective Intelligence", my motivation finally exceeded my laziness in getting the porting code available in a public place. So I’m proud to announce that you can take a look at the ongoing porting effort at my Ruby port of Programming Collective Intelligence. I'm in the midst of Chapter 4 right now, so I still have a long way to go.

There are number of things in the code that make me cringe (it always amazes me how a better solution to something occurs usually about five minutes after I commit), but if nothing else it’s a monument to the effort I’ve made thus far. Hopefully the thought of public shame will motivate me to get in there and clean some of that stuff up.

Note that I’ve deviated somewhat from the book in the naming of things. By and large I’ve stuck to the same basic names, but I’ve followed Ruby’s underscore naming convention for methods and camel-case for module and class names. All of the code is under a single PCI module namespace (though spread around several files). I’ve also included underscore in the database table and column names that go in the SQLite database that is created in Chapter 4 of Toby’s book.

Pedagogically, organizing the code into chapters would probably be more useful to people, but I don’t currently have it setup this way. With a beer and little trolling through the SVN logs I could probably reorganize the repository to match this. If folks want this, lemme know.

One final note, I’ve organized the code into a structure loosely based on a standard Ruby Gem layout. I’ve tried putting some specs around the code that is there, but the overall coverage is pretty underwhelming. I wrote specs to prove that my porting worked, not necessarily to test the underlying code that Toby originally wrote. In short, anytime I ran a manual test more than two times I have (usually) written a spec for it.

blog comments powered by Disqus