Tuesday, March 31, 2009

Programming Haiku

Today in my graduate course we discussed the Berkeley snlog system. This is a declarative programming language for sensor nets, based on Datalog, and derived from the authors' previous work on P2.

Mike Lyons, one of the Ph.D. students in the course, made an interesting observation. He pointed out that programming in these very concise, domain-specific languages is like "writing haiku." The idea behind these various languages is to make programming sensornets simpler by abstracting away details and making the code tighter and easier to grok. Mike observed that he'd "rather write 10 pages of C code than 10 lines of Datalog," which is a very good point -- and one that speaks to a number of projects that equate "fewer lines of code" with "ease of programming."

A number of projects, including several of my own (Flask, Regiment), have focused on simplifying programming for sensor nets. The idea is that building up complex distributed behaviors from low-level programs, usually implemented in C, is too painful for non-experts. The main challenge is grappling with the complex dynamics that arise when you have uncertain environmental conditions, message loss, node failure, and so forth. This is difficult in conventional distributed systems, and even more painful in the extremely resource-challenged domain of sensor nets. To this end, there has been a slew of sensor net language papers, ranging from simple node-based languages to more ambitious, network-wide programming environments. For those without the patience to run them all down, Luca Mottola's PhD thesis does a great job at surveying the field.

Evaluating a language paper, especially in a relatively new domain, is often challenging. In sensor nets, CPU performance is not a good metric -- often we care more about energy consumption, communication overheads, and robustness to failure. Evaluating "ease of programming" is much more difficult. The most common quantitative measure is lines of code, but this is potentially misleading. As Mike pointed out today, the more compact a language is, the more important it is that every line of code is absolutely right -- there's less wiggle room or flexibility to explore alternative ways of implementing the same thing.

Peter Dinda's group at Northwestern has done an actual user study (gasp!) of a simple, BASIC-based language for sensor nets. While this is far better methodology, I'm worried that such an approach is too heavily biased towards absolute neophyte programmers, and this tells us very little about how effective the language will be for writing real applications. After all, most domain scientists who want to employ sensor nets are already programmers (though often in languages like MATLAB). So what is good for a user study may not be good for actual users.

So maybe we need to get away from "ease of programming" as our key metric, and focus on what domain experts really need to leverage sensor nets. It's clear that people can learn a new language if it will help them get their work done. In the end, the language is probably a lot less important than the mental abstraction required to capture a given program.

Sunday, March 29, 2009

I heart Kindle.app

Amazon recently released a free Kindle e-book reader for the iPhone, and I love it. Normally I don't shill products, but I was pretty skeptical about this one and have been pleasantly surprised at how good it is. I've been reading Denis Johnson's Tree of Smoke on my iPhone over the last couple of weeks -- mostly at the gym but also during a few long flights. It's a long book -- over 600 pages -- and having it in my pocket at all times has made it much easier to read bits and pieces whenever I get a chance.

The app is dead simple to use: you simply flick left or right to turn pages, and it automatically remembers your place so that when you relaunch the app you are back where you left off. In the current version, you have to buy e-books via the Web, and the next time the app launches it downloads the content to your phone. I guess this is not so great for spur-of-the-moment purchases while getting ready to board a flight, but my understanding is that a future version will let you buy content directly from the iPhone. As far as I can tell, it eats very little power -- not surprising, but nice to know in case you're worried that spending a few hours reading will drain the battery.

Amazon is definitely undercutting their own Kindle e-book reader by providing this app, and they claim that it was mainly intended as a stop-gap for Kindle owners who want to do a bit of reading in places like the supermarket check-out line. (Is anyone so impatient they really need to read a book while waiting to buy groceries?)

What's it like to read a book on the iPhone? Well, the app lets you pick the font size, which is nice. For reading on the elliptical machine I crank it up fairly large, which means flicking to the next page every 10-15 seconds. When I can hold the phone close and steady I use a smaller font. Actually, I tend to prefer the narrow column of text as it helps me keep my place through saccadic movements -- not unlike some speed-reading techniques -- as I tend to get lost on a large page of text. As it turns out, I actually prefer reading on the iPhone rather than a paper book -- odd.

The best part is that more than 250,000 titles are available and I can use a device I carry in my pocket at all times -- no need for another gadget, charger, USB cable, what have you. I was sorely tempted to buy a Kindle before this app came out, but now there's really no need.

Tuesday, March 24, 2009

Visit to Utah

I had a great visit to the University of Utah this week, and gave a distinguished lecture on "A New Era of Resource Responsibility for Sensor Networks." I had never visited Utah before, and am pretty impressed with their CS department overall. The folks there seem to get along very well and have considerable strength in graphics, languages, and embedded systems in particular. Their Scientific Computing Institute could be a model for what we've been doing at Harvard with the Initiative in Innovative Computing.

Of course, Utah is famous for the Flux research group, led by the late and great Jay Lepreau. Jay was one of my role models and I admired his approach to building real systems and getting others to use them (our MoteLab testbed was heavily inspired by Emulab.) I'm sorry that I never got a chance to visit Utah while Jay was still with us.

One thing that struck me was that the group is built around full-time research staff, which has enabled them to build substantial research infrastructure (such as Emulab) and continue to expand and maintain it beyond the typical timeframe of a graduate student. (It's also true that research staff tend to think less in terms of papers+thesis and more in terms of writing useful code. It's sad that these things are not always compatible in the course of academic research.) It's not a model I've seen used much in other systems groups -- likely because it requires a lot of funding to make it sustainable. Then again, Jay was a powerhouse when it came to bringing in research funds.

It's great to see that the Flux group is still going strong. I'm sure Jay would be really glad to see it.

(By the way, HotOS just won't feel the same without Jay there. We need to appoint an honorary Lepreau Proxy. Any volunteers to ask snarky, meandering questions after each talk?)

Friday, March 20, 2009

Princeton SNS group blog

Apropos of my earlier post on blogging a research project, Mike Freedman at Princeton has started a group blog where they talk about some of their ongoing, and past, projects. For example, he's posting a series of articles on experiences with developing and deploying CoralCDN. Way cool!

Wednesday, March 11, 2009

Top Prof

The success of reality TV shows that feature creative professionals in competitive situations has convinced me that it is time for a reality show for CS professors. Let me propose TOP PROF -- a new Bravo series featuring 12 junior CS profs all competing for the ultimate prize -- tenure at a top department, say -- in which each week one professor is voted out of the department until only one is left. The judges would include recent Turing award winner Barbara Liskov, the irascible but highly respected Andy Tanenbaum, industry bigwig and firebrand Al Spector, and (for comedic relief and 80's throwback cachet) the voice of WOPR from War Games.

Each week the contestants would have to face a different challenge that tests their ability to be the Top Prof. For example:
  • Review 25 conference paper submissions in 72 hours flat;
  • Prepare an undergraduate lecture on a topic you haven't seen since sophomore year;
  • Write a multimillion dollar grant proposal with six Co-PIs from three other universities in a week (and get all of the budget spreadsheets to work out!);
  • Juggle submitting 4 papers to the same conference, including one poorly written paper by a new grad student that requires a last-minute rewrite;
  • Write a dozen thoughtful recommendation letters for students you only saw briefly in your class three years ago;
  • Respond to hundreds of emails with no more than one-line responses; and
  • Hold a series of back-to-back half-hour meetings all day and manage to stay awake at the colloquium talk at 4pm.
I think this would do wonders to raise the stature of our field. Any volunteers?

Tuesday, March 3, 2009

Corporate sponsorship in Computer Science research

Luis von Ahn came up with a great idea to bolster research funding in an ailing economy -- corporate sponsorship of professors wearing logos while they teach. I wholly support this idea, especially since I currently wear t-shirts from companies like Microsoft, Amazon, and Intel for free. These companies really should be paying me for my advertising their brands to my students, given my ridiculously high degree of influence over them.

Add ImageThe recent New York Times article about drug company ties to medical schools got me thinking about why there isn't a similar controversy with corporate sponsorship of computer scientists. After all, many of us get research funding from companies, and much of that funding comes with an explicit (or implicit) assumption that we will leverage that company's technology in our work. For example, Microsoft gave my group a research grant last year to link our CitySense system into their way-cool SensorMap platform. This was clearly a blatant attempt by Microsoft to get us to use their technology, but how could we resist? We need the funding, and the only ethically dubious aspect of the project was having to program in C#. No pain, no gain, right? (Notice how I used the expression "way cool" in this paragraph? How's that for subtle?)

Apart from research grants, some companies grease us up with really serious perks! For example, Microsoft flies hundreds of CS professors out to Redmond every year for an intense three-day "Faculty Summit," the capstone of which is usually a cruise on Lake Washington with an open bar. Believe me, there is nothing that says "high roller" more than being crammed on a boat with a few hundred geeky CS profs drinking cheap chardonnay after a long day hearing talks about .NET and Windows Media Services. The coolest part is we get these really spiffy fleece vests to take home with us, which would be great for keeping warm in the New England winters except they have no arms. Those dermatologists getting free golf vacations to St. Kitts have no idea what they're missing!

It's clear that this flagrant corporate brainwashing is starting to trickle down to the educational mission as well. Hundreds of universities have ditched standard, non-proprietary languages like C and are now teaching their intro CS courses in -- gasp! -- Java. Here at Harvard, we're letting this nutjob from Sun named Jim Waldo teach a distributed systems course, knowing full well that he uses the entire semester to indoctrinate our students in how to program Java RMI. Stanford is even offering a course on iPhone programming. Both MIT and Stanford named their CS buildings after Bill Gates, and Berkeley named a lounge after -- get this! -- Steve Wozniak. What's next? The Werner Vogels Library? The Sergey Brin and Larry Page Annual Easter-Egg Hunt?

Where do we draw the line with this nonsense?

So I think there is a real crisis here and it's clear the NY Times is just not paying attention. I for one applaud those brave Harvard medical students who have dared to stand up to the insidious support of the drug companies with the expectation that rejecting corporate sponsorship will endow them with a "pure" education. It's only a matter of time before a bunch of CS students wise up to what is going on and do likewise. They may even go so far as to start a Facebook group to protest. Now that would really be something.