Monday, January 19, 2009

Engineering Everywhere, including my living room

This month, I started taking a computer science class online, along with my friend from high school, Corey. Neither of us have any technical experience, but we're taking the computer science class at Stanford for freshmen with no prior background. It's a blast. I won't be able to understand what the Google engineers are talking about anytime soon (hmmm, or ever), but it's fun to tackle the puzzles that come up when you're trying to solve a CS problem.

Take this first assignment for example. We have a robot (named Karel-- he's Czech :) ) who lives in a quadrangle of 3 arches and 4 columns. If you look at the first frame of the video, you can see that the columns have some stones missing. What's the best way to make Karel replace the stones? 



There are four basic commands you can work with:

-move forward
-turn left
-put down a stone
-pick up a stone (we don't use the last command in this particular problem)

[[From the basic commands, you can extend out to "turn around" 180 degrees by commanding two left turns. Also, assume Karel has an infinate number of stones he carries with him.]]

There are three challenges to tackling computer programming. First is simply nailing the syntax; those characters and brackets that the software demands in order to read properly. The second challenge is a more sophisticated logic problem; after you get the syntax right, there are a dozen ways you can get the robot to fix the quad like you see in the video. The trick is how you can define your commands to make your program as universal as possible.

It's easy enough to move Karel to where the gaps are and make him put down stones. We actually want to make Karel think for himself, so that we can relocate him (with the same programming) to a different quad.  So for example, the stones are missing from arbitrary spots; can we make a program that works if the gaps are in different spots? There are four columns of five stones each, but can we program Karel to fix this quad OR a quad of different size and shape?

The third challenge, which is emphasized very eloquently by the prof, is writing programs that humans can understand. You should write so that computers can understand your commands, but it's more important that people can interpret your program too. Here's why.

Programs break. If a new engineer needs to go in to your program and fix it, or if he needs to alter your program to do something slightly different, your program needs to be clear enough for a stranger to make adjustments. Otherwise, he's better off scrapping your work completely.

This last requirement of practicing proper form reminds me of the summer I worked on a boat. There are such particular ways of coiling a rope or tying down the pulleys that raise a sail. I had thought that these rules were extraordinarily nit-picky, but you want standard rules so that in an emergency, any sailor can pick up a line you tied down and adjust it without having to figure out your particular knot. Same goes for a code you've written-- you want it to be as clear as possible.

Taking the class has been fun, as evidenced by the delighted and geeky messages between Corey and me. I encourage other people to have a look:

Lecture 2 | Programming Methodology (Stanford)


Monday, January 5, 2009

Cyberlaw, and Journalism At The Crossroads

Last night, I listened to a great interview of Lawrence Lessig with Terry Gross. Most of what he said were extremely clear and persuasive versions of ideas already on my mind from past articles and programs-- not surprising because Lessig and the center he founded (Stanford's Center for Internet and Society) originated many of our culture's ideas on 21st-century IP law. Overall, he wants the law be flexible and encourage the creativity that content-sharing on the Net allows, from researching academic journals to remixing music samples.

In one great section, Terry asked about the revenue declines that newspapers have been suffering as we increasingly get our news online. Lessig agreed this is a problem, and his greatest concern is that investigative journalism is endangered. Yes we have blogs and Twitter, but newspapers used to assign reporters to a story for months at a time to uncover corruption or expose readers to a faraway war-- an important service for our democracy. Now even major papers can't afford to pay for a long-term assignment.

Lessig said that papers have suffered a lot from Craigslist, which, though a useful tool, has wiped out classifieds. This led me to two questions:

1) Where do newspapers typically make their money? (% subscriptions, % advertising, % classifieds....I would have guessed classifieds are minor.)
2) Do we have a Seymour Hersh (who exposed the My Lai massacre in Vietnam for the St. Louis Post-Dispatch) or Woodward and Bernstein (who broke the story of the Watergate scandal in the Washington Post)? Who are the great investigative journalists of our generation? The two that come to mind are from TV: Christiane Amanpour and Mike Wallace (the latter of which was, incidentally, the great investigative journalist of the last generation).

You can listen to the full interview on the NPR site.

Sunday, January 4, 2009

Improve your life today! Join a book club.

US News and World Report said that joining a book club is one of the top ways to improve your life. Does this surprise you? When my friend Moses shared this report with me and the rest of our book club, it came as no surprise at all. As the book "Bowling Alone" observes, Americans are much less likely to join gardening clubs or rec sports leagues than they were a generation ago. Instead, we're much more likely to watch TV and be disengaged from our communities, and as a result, our social fabric has become much more thin. Book club brings people together for a gathering that is not completely social, not completely work- or task-driven, but a little bit of both.

Here are the details of my group. It was created by my Google co-worker and his friend who, in her day job, does research with an institute at the U of M business school. Our mission is to focus on books that discuss business and social responsibility. You may think that, with such a narrow focus, our book options are limited, but in fact after one year we still have more books we're eager to read than we have time for! Our picks have ranged from the relatively academic (Travels of a T-Shirt in the Global Economy, which traces the life-cycle of a China-manufactured shirt), to The Omnivore's Dilemma, which has become very popular in the media and in "eco-gastronomic" circles.

Our club meets every month at a different house every time. Members are relaxed enough that the decision of where to host and what to read next gets determined at the end of each meeting, and what doesn't get settled is discussed online via our Google Groups forum. (You may have heard of book clubs feuding over book choices like in the article "Fought Over Any Good Books Lately?", but our club is completely drama-free.) We also use our core discussi
on group as a launching pad for other activities. For example after reading The Omnivore's Dilemma, we toured a local farm and did a bit of weeding, and after reading a book on new urbanism, we invited a business-school professor to discuss local real estate and urban development trends with us.

Ever since graduating from college, I've looked for ways to keep exploring with my mind and get connected with people outside my usual circles. I've done this by listening to lots of NPR (and watching the great TED Talks videos online), volunteering, and pursuing exciting projects at work, but the greatest of all these is my book club.