Coding Horror

programming and human factors

A Lesson in Control Simplicity

I was struck, the other day, by how much I had to think when attempting to heat up my sandwich in the microwave. There are so many controls: a clock, a set of food-specific buttons, defrost and timer controls, and of course a full numeric keypad. Quick! What do you press?

Controls on a newer microwave   Controls on an older microwave

I wonder if older microwaves weren't a better, simpler design, with their single giant analog knob. I noticed that every microwave for sale at Target, even the most inexpensive ones, now use a complete set of digital controls.

This is progress?

Maybe something to think about, the next time you're about to add just one more field, button, or link to that form.

Discussion

Geek Diet and Exercise Programs

Software developers aren't typically known for their superior levels of physical fitness. I'm not overweight, exactly, but I don't think I'll be pursuing that dream career in male modelling anytime soon. I charitably call myself an indoor enthusiast.

Tan Lines From Typical Summer Activities

At the risk of generalizing-- yes, I know you happen to be the exceptionally fit software engineer that proves the rule-- being tethered to the machines we love so much often leads to a sedentary lifestyle for programmers, and a high occupational correlation with obesity.

But it doesn't have to be that way. If we can whip computer software and hardware into shape, we should be amply equipped to whip the body's software and hardware into shape, too. Consider the advice of John Walker:

I'm an engineer by training, a computer programmer by avocation, and an businessman through lack of alternatives. From grade school in the 1950's until 1988 I was fat--anywhere from 30 to 80 pounds overweight. This is a diet book by somebody who spent most of his life fat.

The absurdity of my situation finally struck home in 1987. "Look," I said to myself, "you founded one of the five biggest software companies in the world, Autodesk. You wrote large pieces of AutoCAD, the world standard for computer aided design. You've made in excess of fifty million dollars without dropping dead, going crazy, or winding up in jail. You've succeeded at some pretty difficult things, and you can't control your flippin' weight?''

Through all the years of struggling with my weight, the fad diets, the tedious and depressing history most fat people share, I had never, even once, approached controlling my weight the way I'd work on any other problem: a malfunctioning circuit, a buggy program, an ineffective department in my company.

John compiled his advice into something he calls The Hacker's Diet. According to John, all we need is:

  • An eye firmly fixed on the goal.
  • Will power.
  • A high tolerance for pain.

In other words, we are so totally screwed. Jeremy Zawodny used the Hacker's Diet as a template, and came up with this kinder, gentler set of diet advice that's a bit less intimidating:

If you're seriously thinking about trying to lose weight, give this a shot. It's one of the easiest non-fad and non-gimmick plans you'll run across, mostly because the "plan" is very simple and tangible. It's not quite "the simplest thing that could possibly work" but it sure comes close:

  • Small changes have a major impact on weight loss because they're compounded over time. It's just like saving for retirement. The sooner you start doing just a little bit every day, the better off you'll be.
  • Anyone can do this. Anyone.
  • The process is self-reinforcing once you start to see real results. That means you need to commit to a month--a very difficult month. After that first month, though, it's easy. And the more weight you have to lose, the easier it is.
  • During that first month, you'll be developing three new habits. Only one of them is likely to conflict with an existing habit. The other two will consume maybe 5 minutes of your daily routine.

Like any proper geek diet program, Jeremy's is powered by a spreadsheet. In the end, it's basic math -- calories in minus calories out. Since programmers are legendarily obsessive, tracking everything we eat is a natural fit for us.

But reducing calorie intake through diet is only half of the equation. The other half is increasing calorie burn by exercising, or at least staying moderately physically active. A contributor to OmniNerd wore a heart rate monitor and measured exactly how many calories he burned during typical daily activities:

  • 100 calories burned per hour sitting in a chair "working"
  • 5 calories burned riding an elevator up twenty-seven flights
  • 100 calories burned per hour watching TV or surfing the Internet at home
  • 750 calories burned for eight hours of sleeping
  • 220 calories burned in twenty minutes walking 11/4 miles downhill to my bus (+50 calories burned "cooling")
  • 60 calories burned walking one New York City block (west-east) (+10 calories "cooling")
  • 25 calories burned walking up five flights of stairs (+35 calories burned "cooling")
  • 315 calories burned walking 11/4 miles uphill from my bus (+75 calories burned "cooling")
  • 150 calories burned walking a dog for twenty minutes (Note: It was a slow walk, the dog is very old.)
  • 660 calories burned in forty minutes of weightlifting
  • 900+ calories burned in fifty minutes on an elliptical trainer

It's a reasonable set of advice: eat less, exercise more. We may do it more analytically than the average joe, but it's nothing you haven't heard a dozen times before. The problem is getting off our collective butts to do it. It's difficult to get motivated, particularly when exercise almost by definition draws you away from your obsession.

But what if we could combine our computing obsession with exercise?

geek-a-cycle

Now we're talking.

The geek-a-cycle may look vaguely ridiculous. Still, I've often wondered if there was some way to combine all that time I spend sifting through content on the internet with some kind of physical exercise, instead of passively sitting in a chair. It's an interesting concept.

Greg used a similar recumbent trainer arrangement to lose weight while playing the massively multiplayer online game World of Warcraft.

warbiking setup

Greg calls this "Warbiking". It's a clever symbiosis of carrot and stick that really worked for him.

One of the bad parts of Warcraft is it can really suck you in - I tend to lose track of time and get pretty unaware of anything but the game. It's addictive as hell! One of the bad parts of doing Cardio is that it is very boring, so I tend to be very aware of how much I'm not enjoying it and how slow time seems to get. And I hate doing it!

Warbiking is the best of both worlds. I get to do 2+ hours of cardio without being aware that I'm really doing it. And as I can only play Warcraft while doing cardio (that's a self imposed rule - no cardio, no Warcraft), it's self regulating. No way am I going to play for 6 hours; my legs wouldn't do it. I did hit 4.5 hours one insane Sunday afternoon, but I won't be doing that again any time soon.

If you're more of a console gamer, there's the Gamercize. You insert the device between your controller and your console. The device monitors your physical activity, and will disconnect your controller if you fail to sustain a certain minimum level of physical activity.

gamercize in action

The gamercize is appealing because it's universal. It works with any game, but it's not exactly interactive.

Perhaps the best example of a game that integrates physical activity with actual gameplay is Dance Dance Revolution.

Dance Dance Revolution feet

DDR is one of the few games my wife enjoys playing with me. It's available on every platform under the sun, and even has a free open source PC equivalent in StepMania. The songs have a wide selection of skill levels, from ultra-klutz to ninja. If you can get past the natural aversion most people have to making themselves look ridiculous while doing something approximating dancing, it's really quite entertaining. And it's definitely a workout.

You might argue that none of this is really necessary. Wouldn't it be easier to drop all the diet spreadsheets and electric exercise contraptions and cultivate a traditional physical activity as a hobby? Say, something like soccer, or tennis, or cycling?

Sure. It would be easier-- if don't you mind losing all your geek street cred in the process.

Discussion

YouTube: The Big Copyright Lie

I'm a big YouTube fan.

We can thank YouTube for cutting the gordian knot of video codecs. Instead of futzing around with codecs and media players, YouTube's universal, Flash-based web video "just works". After all this time, it turns out the killer app for Flash wasn't advertising or web games. It was video. It's a cross-platform model Microsoft is aping with Silverlight, and for good reason.

YouTube feels like a web institution already, even though the site is less than 2 years old. I love the fact that (almost) any video ephemera I can think of can be found on YouTube, and instantly shared with anyone in the world using nothing more than a web browser and a hyperlink. It's a beautiful thing.

But one thing bugs me about YouTube. On their upload page, you'll find this disclaimer:

Do not upload any TV shows, music videos, music concerts, or commercials without permission unless they consist entirely of content you created yourself. Please refer to our Copyright Tips page for some guidelines and links to help you determine whether your video infringes someone else's copyright.

Take a minute to read YouTube's copyright tips page. I'm serious. Read it. It's full of gems like this:

  • It doesn't matter how long or short the clip is, or exactly how it got to YouTube. If you taped it off cable, videotaped your TV screen, or downloaded it from some other website, it is still copyrighted, and requires the copyright owner's permission to distribute.
  • It doesn't matter whether or not you give credit to the owner/author/songwriter -- it is still copyrighted.
  • It doesn't matter that you are not selling the video for money -- it is still copyrighted.
  • It doesn't matter whether or not the video contains a copyright notice -- it is still copyrighted.
  • It doesn't matter whether other similar videos appear on our site -- it is still copyrighted.
  • It doesn't matter if you created a video made of short clips of copyrighted content -- even though you edited it together, the content is still copyrighted.

Now think back through all the videos you've watched on YouTube. How many of them contained any original content? Let's see. Recently I've linked to the faux Machete trailer from Grindhouse, a classic Kids in the Hall skit (and another one), a surreal computer animated skit called Bingo the Clown-O, and the Writer's Award intro from the 2007 Emmys. Notice anything in common here? That's right. Virtually everything of interest on YouTube is copyrighted content.

It's perhaps the ultimate case of cognitive dissonance: by YouTube's own rules, YouTube cannot exist. And yet it does.

YouTube: f**k copyright(tm)

How do we reconcile YouTube's official hard-line position on copyright with the reality that 90% of the content on their site is clearly copyrighted and clearly used without permission? It seems YouTube has an awfully convenient "don't ask, don't tell" policy-- they make no effort to verify that the uploaded content is either original content or fair use. The copyrighted content stays up until the copyright owner complains. Then, and only then, is it removed.

Anytime we become aware that a video or any part of a video on our site infringes the copyrights of a third party, we will take it down from the site. We are required to do so by law. If you believe that a video on the site infringes your copyright, send us a copyright notice and we will take it down.

It's completely glossed over on the YouTube copyright page in favor of 100% original content, but the loophole in copyright is fair use. Under the banner of fair use, you could legally upload a video without the copyright holder's permission. Anyone who contributes anything to the web should have the four factors of fair use commited to memory by now:

  1. the purpose of the use
  2. the nature of the copyrighted work
  3. the relative amount of the portion used
  4. the market effect of the use on the copyrighted work

These are the four factors courts use to determine if something is fair use. It's worth digging a little deeper to see how these could potentially apply to a typical YouTube video clip.

fair use factors

1. Was it transformative? Uploading a 2 minute clip from Kids in the Hall isn't transformative in the least. Nothing new was added. No context was provided. It's not a parody, it's not research, it's not commentary. It's a small segment of the original content, transplanted to the web. It's only "transformative" in the sense that it's much more readily available to the public.

2. What is the nature of the source material? The majority of clips on YouTube are there to amuse; they draw their source material from works of entertainment. Entertainment is an enjoyable pastime, but it's not a public good. Dissemenation of facts or information benefits the public; video clips of man getting hit in the groin with football.. not so much.

3. How much was taken? YouTube instituted a 10 minute length limit, probably to prevent excessive use claims from taking root. It's a policy that seems to work. Most clips tend to be fairly small, even after factoring in the 10 minute limit.

4. What's the market effect? I find it very difficult to believe that the short, grainy, low-resolution clips on YouTube could have any kind of measurable negative financial effect on content providers. This is one case where YouTube's below-the-bottom-of-the-barrel video quality works in their favor.

The typical YouTube clip does well on the last two factors of the fair use test, but utterly fails the first two. This is not good, because the factors are listed in order of importance; the transformative and nature tests are considered the most significant factors by courts. It is not possible to make a supportable fair use case for most video clips using copyrighted material on YouTube.

I'm not attacking YouTube here. I think having access to all this copyrighted content in bite-size embeddable form is ultimately a net good for both consumers and creators. What I don't understand is why YouTube continues to get away with the big copyright lie they've perpetuated from day one. They pay lip service to copyright, while building their business on an empire of unauthorized, copyrighted content. It's so brazen-- so blatant.

You can argue that copyright law is broken. I won't disagree with you. But I still dislike YouTube's massive hypocrisy in this area, and I wonder why other people and companies don't get the free ride from the hyper-litigious entertainment industry that YouTube seems to enjoy.

Discussion

Do Not Buy This Book

A few friends and I just wrote a book together: The ASP.NET 2.0 Anthology: 101 Essential Tips, Tricks & Hacks.

The ASP.NET 2.0 Anthology: 101 Essential Tips, Tricks & Hacks

I met K. Scott Allen, Jon Galloway, and Phil Haack through their excellent blogs. That online friendship carried over into real life. We always thought it'd be fun to work on something together, and when the book project materialized, we took it on. It was a natural fit for a group of established bloggers who have suffered the slings and arrows of three versions of ASP.NET; we have war stories to share.

But do not buy this book.

Why buy what you can get for free? As long as you have a blog, live in the US or Canada, and promise to write a review of the book, I'll mail you a free review copy. (I apologize to my international readers, but the international mailing process is just too onerous.) Shoot me an email containing a link to your blog, and your mailing address, and I'll send out the book. I have five to send, plus my fellow authors might have a few additional copies to contribute. I sent as many as I could on a first come, first served basis.

But there's another, more important reason you shouldn't buy this book. It's a technical book tied to a specific technology, and I'm not sure those kinds of books have a future. Don't get me wrong. This blog was founded on the concept of a recommended developer reading list. I have a deep respect for books and authors. I recommend books all the time-- but never highly technical books. I stock my shelves with books about timeless concepts such as design, process, people, and craftsmanship. Do highly technical books tied to a specific technology have any reason to exist in an era of ubiquitous, high speed internet access? I wonder. I think they're increasingly irrelevant, and almost by definition out of date by the time they manage to hit bookshelves.

I think back to the highly-rated technical books I bought on Amazon in 2002 when I was learning .NET. Embarrassingly, I never even cracked open most of those books. I spent the majority of my time learning by browsing articles on the web, downloading and modifying code. Maybe I'm too impatient, but I found the internet such an effective and immediate companion that the books I bought couldn't possibly compete. I realized five years ago that technical books were almost obsolete. I don't see anything today that would cause me to change my mind; if anything, the rate of obsolescence has accelerated.

As I went through the book writing process for the very first time, I also found that being an author isn't nearly as glamorous as one might imagine.

  1. Writing a book is hard work. For me, writing blog entries feels completely organic, like a natural byproduct of what I already do. It's not effortless by any means, but it's enjoyable. I can put a little effort in, and get immediate results out after I publish the entry. The book writing process is far more restrictive. Instead of researching and writing about whatever you find interesting at any given time, you're artificially limited to a series of chapters that fit the theme of the book. You slave away for your publisher, writing for weeks on end, and you'll have nothing to show for it until the book appears (optimistically) six months down the road. Writing a book felt a lot like old fashioned hard work-- of the indentured servitude kind.

  2. Writing a book doesn't pay. I'd be fine with the relentless grind of writing a book if you could make a reasonable living at it. According to Mike Gunderloy, less than 30% of computer books sell enough to generate any royalties whatsoever. I suspect far fewer sell enough for the authors to achieve the same wage they could by working a traditional job.

  3. Anyone can write a book. Even if books make no financial sense, perhaps the ancillary benefits can make the effort worthwhile. I won't lie: you'll get a little thrill the first time you ego-search Amazon and see your book in the results. There is a certain prestige factor associated with being published; people are impressed by authors. To me, these are ultimately empty accolades. Anybody can write a book. The bar to publishing a book is nonexistent; with sufficient desire, any would-be author can get published. Just because you've published doesn't mean your book is worth reading. It doesn't mean your book matters. It just means your book exists. Far from being impressive, that's barely meaningful at all.

  4. Very few books succeed. Anyone can author a book. But precious few can author a successful book. For books, the only meaningful success metric is sales, as you have no way of directly measuring eyeballs. In the physical world of published atoms, blockbusters rule. Nothing other than the biggest of hits moves the sales needle enough to register. Bruce Eckel says less than 1% of books are actually successful. At best, 99% of books will have a brief peak of sales-- hopefully enough to earn back your advance-- and then crash directly into irrelevance and permanent out-of-print obscurity.

In short, do not write a book. You'll put in mountains of effort for precious little reward, tangible or intangible. In the end, all you will have to show for it is an out-of-print dead tree tombstone. The only people who will be impressed by that are the clueless and the irrelevant.

As I see it, for the kind of technical content we're talking about, the online world of bits completely trumps the offline world of atoms:

  • it's forever searchable
  • you, not your publisher, will own it
  • it's instantly available to anyone, anywhere in the world
  • it can be cut and pasted; it can be downloaded; it can even be interactive
  • it can potentially generate ad revenue for you in perpetuity

And here's the best part: you can always opt to create a print version of your online content, and instantly get the best of both worlds. But it only makes sense in that order. Writing a book may seem like a worthy goal, but your time will be better spent channeling the massive effort of a book into creating content online. Every weakness I listed above completely melts away if you redirect your effort away from dead trees and spend it on growing a living, breathing website presence online.

That said, some people are quite successful writing technical books. Did I mention that I co-wrote a technical book with my friends? Many people find such books quite useful.

Unfortunately, I'm not one of them.

Update: Charles Petzold has posted his thoughts on the current state of technical book publishing. Needless to say, it's highly recommended, as Charles has a lifetime's worth of experience on this topic.

Discussion

Revisiting Programming Fonts

I've experimented with programming fonts and IDE color schemes plenty in the past. But now that I've given in to the inevitability of ClearType on large LCDs, I've basically settled on Consolas. It's hard to beat Consolas. It's darn close to the ultimate monospace programming font in my estimation. That's why I was so intrigued when I read about Inconsolata, a non-denominational OpenType relative of Consolas, which unlike Consolas, works equally well with ClearType enabled or disabled.

Once I tried out Inconsolata, I figured I might as well revisit all the common, popular programming fonts under the same conditions. So here goes. These are rendered under Windows Vista, with ClearType enabled, using my standard programming font comparison code sample.

Consolas, 11 point.

Consolas font, code sample

Inconsolata, 11 point.

Inconsolata font, code sample

Monaco, 11 point.

Monaco font, code sample

Envy R, 11 point.

Envy R font, code sample

Vera Sans Mono, 11 point.

Vera Sans Mono font, code sample

Pragmata, 11 point.

Pragmata font, code sample

Courier New, 11 point.

programming-fonts-2-couriernew.png

Lucida Typewriter, 11 point.

Lucida Sans Typewriter font, code sample

The Font of the Gods, 11 point.

Comic Sans font, code sample

Andale Mono, 11 point.

Andale Mono font, code sample

Choice of programming font is as much a personal preference as anything else. Decide for yourself what works for you. I'll limit my comments to a few observations:

  1. Please don't use the default Courier New typeface. Be kind to your eyes.
  2. Personally, I still don't think anything beats Consolas; it's an outstanding monospace typeface design, highly optimized for ClearType display on LCDs.
  3. I'll never understand the appeal of Monaco amongst the Mac crowd. It's an unreadable mess to my eye.

Discussion