beta baby naming
Saturday, January 10th, 2009The beta version of a Javascript app I built is now available at wiki.name.com.
You can filter the names in the spinners by origin, meaning, gender, popularity, length … it’s a fun way to learn about names or—if you happen to be looking for a name for your baby—to find for a name for your baby.
The interesting programming challenge here: there are around 3000 names in the wiki, and the user should be able to spin through all of them by clicking and dragging (or “throwing”) the spinners. No browser could be expected to cope with a list of 3000 names, so the trick is to only display the subset you need at any one time, and do as little work as possible to add and delete list items on either side of the current set, and only add or delete when necessary. It’s similar to how google maps works: they only load the bits of map that you need to see at the moment, and not the entire world.
It’s conceptually pretty easy to visualize, but add in filtering by properties on the names, type-to-jump to a name, and various weird edge cases, and it’s not entirely trivial to implement. (And there are still a few glitches, particularly when using the arrow keys to nudge the list up or down.)
There’s also the issue of synching the names in the baby naming wizard with the wiki data. Rather than asking the wiki to output its entire database on every page load, we periodically run a server-side script which JSON-encodes the data into a single file.
The app was built with the most excellent jQuery and the plan is currently to open source the core spinner code and release it as a jQuery plugin. It’ll probably be a little while before that happens. In the meantime, congrats to name.com for getting this out there, and if you’re reading this, I encourage you to support them by checking it out, playing around a bit, and contributing to the wiki!
