The maze book for programmers!
PragProg Amazon

Algorithms, circle mazes, hex grids, masking, weaving, braiding, 3D and 4D grids, spheres, and more!

The Buckblog

assorted ramblings by Jamis Buck


15 November 2006 — 1-minute read

Marcel Molina, Jr. has a real talent for discovering elegant API’s. It’s been a treat working with him this last year, watching how he spends a little extra time on the developer interface to the unit tests or a library, making it nice and clean. I wish you could see what he and Sam did with the tests for Campfire!

In a recent post to the Projectionist tumblelog, Marcel provides a tip for avoid[ing] cluttering built in classes by using just in time convenience methods. I love it! His focus is specifically on the instance_eval in the find_items_matching method, but I love the whole snippet. Take a string, extend it with some methods, and voila! A mini-API for querying that string. So much cleaner than just chaining a bunch of grep and match calls together. His instance_eval trick really just adds another mini-API to the array that is returned. API’s within API’s! Neat stuff.

Reader Comments

Marcel showed off some of the Campfire tests in a presentation he made at Chirb. Start at page 54 of this PDF: