Unit Tests Are Not a Substitute for Your Brain

I spent all day yesterday getting unit tests to pass. 

I’d set my module to run in one of two modes, then run the test suite.  I fixed all the test failures, then set my module to run in the other mode, and fixed all those failures. 

Then I’d go back to the original mode, and lo!  More test failures.  I fixed them, then switched back to mode two.  I spend the better part of the day in this loop.  After lunch I realized perhaps I should step back for a moment and think about the problem.  All these failures were related, and I had simply been playing whack-a-mole with test failures rather than actually thinking about the problem.  Ten minutes of thinking, twenty minutes of changes, and suddenly everything worked.

I’m certainly glad we have tests to verify what I’ve done, but I’d have saved myself a lot of time if I’d not used the tests as an excuse not to use my brain.

Estimation vs. Procrastination

I have come to realize that I am terrible at estimating how long a software development task is going to take.  I’m like Jeff Atwood with his proverbial 6 to 8 weeks, except that my default answer is “about a month.”  The truth is, I’ve let this go on for far too long because I don’t feel terribly bad about my incredible lack of precision.  I’ve never tried particularly hard to come up with an estimate I truly believed in.  Bad estimates are so common, it never felt like a big problem.  Still, I’d hate to think I do this badly simply out of laziness.

In my professional experience, estimates are usually bad for some combination of these factors:

  • The developers doing the actual work aren’t involved in the the estimation process. 
  • When developers participate, they answer with vague platitudes: “about a month.”

Neither the project managers nor the developers are trying particularly hard.  To get a good estimate, you have to drill down.  It could take some time.  But unless the full schedule is well over a year, if you’ve only dug deep enough to estimate with a precision measured in weeks, your estimate is worthless.  It’s a form of denial.  You’d be in a better position if you acknowledged that you don’t really have a schedule, and dealt more proactively with the ramifications.

I can think of another excuse for my sad estimates.  Years ago I read a book by Barry Moltz called You Need To Be a Little Crazy: The Truth About Starting and Growing Your Business.  The thing I remember most from this book was an entrepreneur who admitted that if he’d known how much work his own business was going to be, he never would have gotten started.  He wasn’t regretful about having to work hard, in fact he felt fulfilled and considered his business a success.  He was admitting that if he’d been less naive, he probably would have missed out on his success.  This is true about all kinds of endeavors in life: sometimes it’s easier to get started if you don’t think too hard about how much work it’s going to be.  Think instead about the potential results.  Creating software is no exception.  Unfortunately, coming up with a good estimate requires one to examine in excruciating detail just how much work you have to do.

It’s often easier to find some interesting edge of a problem and start there without worrying too much about the big picture.  You can build momentum this way, and that ephemeral momentum is of paramount importance in creating anything great.  The best work is done in prodigious bursts of enthusiasm.  Momentum is key to plowing through the less interesting parts of a project.  Nonetheless, particularly when you’re working as part of a team, your estimates are also important.  Bad estimates have real consequences.

For a task that’s only a month or two long, I could realistically break it into tasks measured in hours.  This is going to reveal a painful picture of every mind-numbing detail ahead, before I have any momentum at all.  But in my quest to be a better estimator, I have decided to acknowledge something.  This isn’t going to make it easier to procrastinate.  It’s going to make it harder.  I’ll be able to measure in very concrete terms what I didn’t get done those two hours I was hypothetically reading about some 16-year old in Florida who, God willing, could be the next great Michigan quarterback in 2012.  Hypothetically.

Grunt… ONE!

If there is a writing muscle, mine is decidedly flabby.  Atrophied might be a more apt description.  This post is tragically less than the editorial equivalent of a single sit up,  but it’s also an excuse to see how Windows Live Writer works.  This week I learned that Brian Cook, author of the best blog in the universe (at least from September through January) uses Live Writer.  That reminded me that I had tried Live Writer a while back, which reminded me that I had a blog.

But I haven’t been lying in bed eating deep fried Twinkies all this time.  The next major releases of Vault and Fortress are creeping up, and I’ve been hard at work on them.  I made some major infrastructure improvements to Vault’s merge feature that will pay big dividends in the future.  I also tackled a couple of long-standing feature requests in the Visual Studio integration that were too big for a minor release.  Jeremy’s blog will have the juicy details.

Chrome is Really (Really) Good

I’d like to join the other zillion people who installed Chrome today and exclaimed, in unison: wow!

I installed Chrome 20 minutes ago, and I’m already impressed.

On literally the first page I visited, I noticed a dramatic speed difference compared to Firefox. I don’t use IE frequently, but when I do it seems roughly equivalent to Firefox. Chrome, on the other hand, was dramatically faster. Javascript-heavy pages like GMail are wicked fast. Unlike all those performance improvements I read about in Firefox 3, the speedup is dramatic enough to cross that all-important “perceptible by a human” threshold. So that’s nice.

I like the minimalist interface. All the meaningless stuff surrounding the page (*cough* the uh, chrome) is gone. The default start page actually makes sense: it lists the pages and bookmarks you visit most. I might not even change my default page to about:blank for the first time since 1998. I love that you can turn off the bookmarks toolbar, after which those bookmarks show up where you’d logically use them: the default start page.

It’s not perfect. On my laptop, the vertical scroll area of the touchpad is wonky. It’s way too sensitive and only scrolls down. Every time I forget and reach for it, I immediately scroll to the very bottom of whatever page I’m looking at and get stuck there. That’s annoying enough that I probably won’t make Chrome my default browser on this machine until it’s fixed.

I also miss several things I’d gotten used to in Firefox:

  • The Adblock Plus plugin. I’ve been using Adblock for most of the 21st century, and 20 minutes without it is already too long.
  • The del.icio.us plugin. I use at least 3 machines regularly. Portable bookmarks are essential.
  • Keyword searches. Typing in the address bar searches Google by default, but I’ve got at least a dozen customized keyword searches set up in Firefox. Not being able to determine if The Dark Knight is still the best movie of all time with a simple ALT+D “imdb the dark knight” really cramps my style. Oops. Looks like Chrome does this. Awesome!

Overall though, it’s an incredibly good “beta” browser. I can’t remember the last time any application made me literally say “wow” within 10 seconds of launching it for the first time. And I’ve only done pedestrian browsing. I haven’t yet scratched the surface of the browser-as-platform features at the heart of Chrome. Google’s done an incredible job with this opening salvo in the new browser wars.

Idle Musings

I wasn’t aware of Randy Pausch until the day he died. That day I watched his Last Lecture and wondered aloud, “How have I not heard about this guy until just now?” Even my wife had heard of him. (I guess he was on Oprah? Seriously.) I find his story very inspiring as a fellow techie, father, and husband. It seems like he had it all figured out.

IDE-integrated source control would be so much easier to use if the whole concept of binding just went away. There’s a huge number of complications that arise from binding and varying opinions on how it works, actually and theoretically. Making IDE-integrated Vault work without binding is theoretically possible, but it would require pretty significant fundamental changes to non-IDE-related functionality. I think about it frequently, but it’s difficult to make the case that the benefit would be worth the cost.

It seems to me that with ten fingers, the natural convergence point for the human race should have been a base-11 written numerical system: you should run out of symbolic digits when you run out of physical digits. In base-10, you have to add a new column when you’ve still got one finger left! What a hack! Strangely, a half hour in Google and Wikipedia reveals no evidence of any non-fiction tribe or civilization, ever, that used a base-11 system. This gives me pause: what else do I consider perfectly reasonable and elegant that is demonstrably absurd?

I spent 9 days on Kentucky Lake this summer, sans laptop, and actually got ridiculously tan. Linda in support, (a professional people-person) mocked my bleached white eyebrows when I got back.

I’m reading Michael Lopp’s Managing Humans. I’ve read his blog for years, so in theory I’ve already read most of this, but I still find the book to be excellent. It’s both entertaining and informative. His writing style translates exceptionally well to dead-tree format, in my opinion. Lots of his advice pertains mainly to working in companies much larger than SourceGear, but I’m still enjoying it tremendously.

Summer Tan

With Memorial Day just around the corner, we’re entering the season where I inevitably endure comments from friends and family with respect to my tan, or lack thereof. So in an effort to prevent the shock and awe the apparently occurs when I don a pair of shorts, I present this guide.

Tan Lines

How to Melt Your Web Server

Wow. Self-employment has made Jeff bold! Incendiary, even.

We Don’t Use Software That Costs Money Here:

It’s tempting to ascribe this to the “cult of no-pay”, programmers and users who simply won’t pay for software no matter how good it is, or how inexpensive it may be. These people used to be called pirates. Now they’re open source enthusiasts.

Vista Folder Views and My Newfound Curmudgeonry

If Vista decides, one more time, that the appropriate columns when looking at a folder full of C# source code is Artists, Album, Genre, and Rating, I’m going to go postal. I keep fixing it, and everything’s fine for a few weeks, and then it does it again. Yes. I have SP1 installed.

This morning I searched Google for “Vista folder view f***ed” (without the stars) and, amusingly, the second result led me to a fix. I’ve removed from the registry all the folder-specific view settings that Vista oh-so-cleverly remembered on my behalf. If it actually did this competently, that would be one thing, but if it’s just going to confuse itself every few weeks, I’ve got better ways to spend my time. So I’ve also turned off the “remember each folder’s settings” option. Call me crazy, but when looking at a list of files I actually want to see file-like information like size, date, and attributes. I genuinely miss Windows NT 3.5’s file explorer sometimes.

I’ll be 31 this year. Perhaps I’ve already begun the slow decline to cranky old geek. Soon I’ll be looked at by fresh-faced college kids the same way I looked at the graybeards reminiscing about core memory and punch cards.

Vault 4.1 / Fortress 1.1 Ships

Vault Today we shipped Vault 4.1 and Fortress 1.1. Follow those links to the release notes to see exactly what’s new.

This seems like as good a place as any to thank the many early adopters who took part in the beta for this release. In no small part due to your help, we made significant improvements in the usability and performance of the Visual Studio Enhanced Client (formerly the Visual Studio 2005 client).

For developers who use IDE integration, particularly those upgrading from a 3.x version, I recommend checking out this FAQ.

All of the graphical clients (Windows, Visual Studio, Eclipse) also got a face lift with this release. The FAQ includes a few screen shots.

Finally, if you’d like to keep abreast of all Vault and Fortress-related releases, there is an RSS feed for our release announcements.

Fortress

Why I Love Neal Stephenson

I’m reading Cryptonomicon for the second time, having rediscovered it on a basement shelf and remembering that I really enjoyed it years ago. Last night I got to this part, when Randy’s trying to crack the Arethusa intercepts from his Manila jail cell:

“Who framed me, then?” Randy asks, kind of rhetorically. He was just in the middle of doing some pretty cool C++ coding when he got yanked out of his cell to have this surprise encounter with the Dentist, and is surprising himself with just how bored and irritated he is. He has reverted, in other words, back into a pure balls to the wall nerdism rivaled only by his early game coding days back in Seattle. The sheer depth and involution of the current nerdism binge would be hard to convey to anyone. Intellectually, he is juggling half a dozen lit torches, Ming vases, live puppies, and running chainsaws. In this frame of mind he cannot bring himself to give a shit about the fact that this incredibly powerful billionaire has gone to a lot of trouble to come and F2F with him. And so he asks the above question as nothing more than a perfunctory gesture, the subtext being I wish you’d go away but minimal standards of social decency dictate that I should say something. The Dentist, no slouch himself in the social ineptness department, comes right back as if it were an actual request for information.

Obviously any book that contains the phrase “pure balls to the wall nerdism” is probably good. An author who writes entertaining fiction and knows the software developer’s mindset this well is rare. Hilarity ensues. I can’t say that I’m proud of these moments, but what professional software developer hasn’t been there? Of course, I’d have to substitute an “oblivious coworker” for the “incredibly powerful billionaire,” making the caricature even more painful. :)