I had the pleasure of chatting with Andre Lewis, lead author of “Beginning Google Maps Applications with Rails and Ajax”. We talked about his fascinating array of cool Rails-driven online services and projects he’s spearheading, the new book, and tips for budding Rails developers.
Question #1: What prompted you to create hotspotr, and how does this service differ from competing services such as jiwire?
Hotspotr came about because I was working at my home office a lot, and wanted to find some cafes around town that were WiFi- and laptop-friendly. A friend who also works independently knew a couple good cafes here in San Francisco, and suggested I put a list online. Once I threw the list together, it made sense to apply the Google maps API, and the site as you see it evolved from there.
Hotspotr differs from sites like jiwire in that it focuses on hotspots where you can sit down, sip a coffee, and get some work done. The rating system on hotspotr reflects this—for example, there’s a rating for how easy it is to find a power outlet. When I visit jiwire or anchorfree, I get lost in the listings. Hotspotr trades off sheer numbers for focus and usability.
Another thing that people like about hotspotr is that it’s decidedly non-commercial. From the start, it was intended to be community effort. I would love to see the service become the Craigslist of WiFi cafe listings.
Question #2: Did you create GeoKit to deal with some of the inefficiencies you uncovered during the development of hotspotr, or was this a project you’d had in mind for some time?
GeoKit was driven by the desire to package some common techniques for mapping applications into a tidy, reusable package—both for future projects, and for use by the Rails community. The dynamic nature of Ruby makes for some awesome extensibility, and GeoKit leverages that. During the development of hotspotr, I created methods on several classes for “find within radius”—and of course, that method is useful for any class that has latitude and longitude attributes. It’s exactly the scenario that calls for a Ruby technique called a “mix-in,” which allows you to easily apply common functionality to multiple classes without stressing about an inheritance hierarchy.
I want to thank to Bill Eisenhauer for taking the trigonometry behind the distance finders and putting it into proper mix-in form. With that crucial foundation done, we added a bunch of geocoding service wrappers and a few other pieces of functionality (such as location lookup by IP address), and GeoKit was born! It’s my first Rails plugin (and Bill’s too), and we’re both pleased by the response.
Question #3: Your book, “Beginning Google Maps Applications with Rails and Ajax” just published. What do you think is the most compelling tidbit readers stand to gain from picking up a copy?
One of my favorite techniques in the book is using RMagick to dynamically create images to overlay on the map. You can display anything you want on the map, however complex the information is. It’s the same technique Google uses to render the hybrid maps view (satellite imagery overlaid with semi-transparent images of streets, names, etc)). It’s a very interesting and powerful technique.
I should note that this is a very JavaScript-intensive book. The Google Maps API is in JavaScript, and we chose to leverage the API directly, rather than use intermediary Ruby helpers. So, I think another benefit of the book for many Rails developers will be to enhance their understanding of JavaScript. Although we call it all Ajax now, we have to remember that the rich interactivity we enjoy in web applications these days—including Google Maps itself—is because of JavaScript. I think it pays to get closer to the JavaScript code than many Rails developers are.
Question #4: Working on any other interesting projects at this moment now that the book is complete?
Definitely! TwoBlocksDown is going to be a localized question and answer service, with a focus on the locations people talk about in the Q&A threads. Of course it will incorporate Google Maps, and it’s written in Rails. I’m psyched about the project because I think a lot of people will find it useful—especially in smaller cities and towns where sites like Yelp don’t have a strong presence. I’m working on TwoBlocksDown with Derek Haynes of HighGroove Studios, and it’s shaping up to be a great project. I’ve got a couple more cool projects on the back burner, check my blog for updates.
Question #5: What’s the best bit of advice you can give to budding Rails developers?
Don’t waste too much time figuring out the “Rails Way” to solve whatever problem you’re working on. It’s easy to get fixated on coding style, since ruby is an extremely idiomatic language and Rails is a very prescriptive framework. But remember: a live site with hacked-together code is always better than a half-finished site built with perfect Ruby goodness. Once you hack your own way through the problems, you’ll be much better positioned next time to understand why the idiomatic Ruby form or Rails convention is the way it is. And, you’ll have a live site under your belt as well!
Jason
