Archive for November, 2007

reading your code

Wednesday, November 14th, 2007

Reading code can be more difficult than writing it.   Coding Horror quoting Stan Kelley-Bootle’s book “The Devil’s Dp Dictionary”:

your program (n): a maze of non-sequiturs littered with clever-clever tricks and irrelevant comments. Compare MY PROGRAM.

my program (n): a gem of algorithmic precision, offering the most sublime balance between compact, efficient coding on the one hand, and fully commented legibility for posterity on the other. Compare YOUR PROGRAM.

solr rocks

Wednesday, November 14th, 2007

If you want to add search to your site, I highly recommend solr, a search server that builds on the lucene java information retrieval library. It does many powerful things out of the box–faceted search, highlighting, caching, etc–and the community around it is stellar. Plus it plays nice with ruby and python, giving you eval-ready output formats for both languages.

Over at the Rooftop Collective I’ve been hacking together some fun stuff on top it, adding local search and social search to the mix. After working w/ the code for a while, a couple things I really like about solr:

  • dynamic fields: This is sweet. You specify a wildcard pattern (say ‘*_f ‘), associate a type with it (say, float) and then can define a new field on the fly as you’re indexing a document (say, my_field_f). This is far more flexibility than I’ve ever seen a database provide, particularly at runtime. In practice, it lets you describe and search your data in ways that evolve as the application runs.
  • function queries: functional programming sneaks into Java.  You can create and compose arbitrary functions that run on your data set, mainly for sorting, but also for displaying calculations (like distance from a point).

Messing w/ solr also reminded me that I still don’t like hacking Java. Don’t like the verbosity. Don’t need the type safety–I can think clearly and write unit tests instead, thanks. Also, miss the built-in looping constructs from ruby. Also, miss the built-in fixtures from Rails. Don’t, however, miss the under-documented APIs from Ruby or Rails. Though it’s always fun to skim through random blog posts to figure out just what frob.foo() is really up to, why my computer spits fire when I call it, etc.

*feed* by m.t. anderson

Sunday, November 11th, 2007

Very powerful, very well-written, very dark.I would have like a more hopeful ending. It took me a day to get over the feeling I closed the book with. While disintegration of humanity is memorable and powerful, it’s also irresponsible to leave it in shambles with no hope.

Feed made me think a lot about facebook. In some ways it’s different than Anderson imagined it–up until now, we’ve mainly been broadcasting to ourselves instead of the companies broadcasting to us. True, the structure of our messages is controlled, steering our thoughts toward easily consumable, re-displayable sound bites, but that’s a general trend in online culture (aside from blogs).

Now though, with last week’s launch of the facebook social ad program, facebook takes an eerie turn toward the structures in anderson’s book. You (supposedly) tell facebook the things you consume, the bands/brands (their merger, clever folks they are) you like, and then facebook crafts advertisements for both you and your friends that are specifically tailored to these preferences.

This is presented as a service. No, really. I mean, I get it–advertisements are a semi-necessary evil to support media services. I may need to use them to support the service I’m building too (sigh). But how creepy of facebook to pretend that we should like them, that we should be happy when they pin us to a demographic more accurately.

And the part about crafting advertisements for you based on what your friends bought? Creepy. I mean, is this the 50s? Are we all keeping up with the Jones, lusting after the goods our neighbors own? Sure, maybe it’ll work, but as the great stoop-side philosopher Arash Pessian once observed, “Does it make the sort of world you want to live in?”