June 23, 2020
(This is going to be a long story. But if you’d like to just skip to the source code, you’re welcome to.)
Twenty years ago, I was a kid in college.
Specifically, in the late ’90s, I was a college student living off-campus at Penn State, and I had a problem. The small video-game company my friends and I had started had gone bust, and I was switching back to DOS and Windows after some years of running only Linux on my computer. I’d just upgraded the DOS partition from Windows 95 to Windows 98, and the 2-gigabyte partition I’d installed it on had completely run out of space. I’d poked around at the folders in Windows for a few days, and tried using ‘dir /s’ at the command line, but there just wasn’t any way to get a holistic view of what the heck had eaten up my hard drive after installing Win98 on it: There wasn’t any way to see where all that space had gone.
Some time in 1997, after a month of futzing with my computer to no success, I was sitting in a barbershop, poking through one of the magazines, when I saw some nested rectangles with labels inside them in one of the advertisements, and I got an aha! moment. What if I could draw a picture of the hard drive? Using rectangles, like those ads? That were sized according to the sizes of the files?
I had rediscovered treemaps.
(Years later, I would find out that Dr. Ben Shneiderman had discovered the same idea about a decade before me. And it’s entirely possible that in the course of reading nearly every book, journal, and publication in the university on high-speed graphics during the video-game company days, that I’d seen an article by him the knowledge resurfaced. I don’t mind saying that he did it first, and maybe I subconsciously copied it!)
I ran back to my apartment after that haircut, scribbled some notes on my whiteboard, spent a few minutes working out the recursion — it was far simpler than calculating a BSP tree had been! — and I wrote what would then become SpaceMonger 1.0, in a single afternoon. (Warmongers seek war, peacemongers seek peace, and me, I sought disk space. It was a stupid name, but I didn’t have a better one.)
The code was clunky, but it worked, and it was fast enough for me to finally figure out what had happened to my disk. (Three answers: There were leftover installation files from Win98, and also some old forgotten images hidden away, and also Win98 was just big for the time.) I showed SpaceMonger to my roommates, and they thought it was neat and snagged copies of it. Over the course of the next week or two, I upgraded it, fixing bugs and adding features, making it nicer and more usable. By the end of that first week or so, there were a few buttons for zooming into folders, and for deleting files.
Figuring that nobody would really want software some college kid made in his bedroom, I posted SpaceMonger 1.3.0 here on my website. And, in truth, nobody really noticed for the first few months.
But then people started to download it in late 1997. They shared it with their friends. I got e-mails with questions. It got included on CDs of free software, and on websites listing free software. On a lark, I used my college French to translate it (badly!) when someone from France asked me a question over e-mail about how to use it, and thus by August 1998, SpaceMonger 1.4 was available in more than one language. I didn’t have a lot of time during my summer job to work on it, but I had enough.
Then school started up again. I was loaded up on classes, and biking four miles each way to campus from my new apartment, and SpaceMonger was mostly forgotten. I graduated in December 1998, and I took a big sigh of relief that college was at last over.
But I still had a lease on the new apartment.
Any normal kid would likely have cut the lease, taken the hit of three months’ rent, and gone out to find a job. But I’d done a lot of interviews near the end of my time at Penn State, and I was wholly convinced that the dot-com boom was not something I wanted to participate in. So I stayed in my apartment, paying rent with small consulting gigs, and spent a lot of my time researching. Studying. Thinking about what to do next.
I made a lot of weird software in those years after Penn State — like Mu, a replacement standard library for C++ when the STL was still in its infancy and seriously broken on almost every platform. Or WinBump, a bump-mapping texture-mapping tool that grew out of the video-game days.
But always there was SpaceMonger. I kept getting e-mails about it, fairly steady, asking for a new feature or a change or this or that, or just thanking me for its existence. And somewhere around early 2000, I realized that SpaceMonger had the potential to be my big commercial break, if I could make it good enough. I started coding on SpaceMonger 2.0, which became 2.1 for complicated reasons — but the full SM 2.x story is for another time.
SM 1.x managed to succeed because it was conceptually simple, easy to use, and free. It did exactly one thing and did it well. It was included by a bajillion download sites, and you can likely still find it online somewhere without searching very hard. Even decades later, I still get e-mails from people who love SM 1.x, people who liked SM 2.x but still go back to the original.
SpaceMonger is approaching 23 years old now — it’s older now than I was when I first wrote it! And it’s well past time to release the source code, so that a new generation of programmers can learn from my ideas and mistakes. There are some good ideas in there, and some awful mistakes, and in just a minute, we’ll talk about what were the best parts and what were the worst.
So the source code of SpaceMonger 1.4 is now posted on my GitHub account, released under the MIT open-source license. That means you can copy it, you can recompile and remix it, you can mutate it, you can reuse it, and you can even sell it — you just can’t claim you wrote it. (Also, you can’t complain if it doesn’t work, since it’s free.) It was designed to compile under Visual C++ 6 (i.e., Visual Studio ’98), but you can probably make it compile under today’s tooling with some effort. Good luck, and let me know how that works out for you if you try 🙂
At some point here, I also intend to release the source code of SpaceMonger 2.x. It’s much, much bigger and more complex than SM 1.x was, and includes a whole lot of neat stuff that the open-source community might want to steal. In particular, its treemapping engine uses some algorithms I’ve never seen elsewhere, algorithms that took me forever in front of a whiteboard to discover, algorithms that make it able to do almost instantaneous treemap layouts, layouts that were so fast that it could even do that cool animated zooming thing it did, even on a clunky old Windows 98 computer. I don’t have the energy to package all that up yet and release it right now, but it’s definitely coming… one of these years when I can get around to it.
SM 1.x, the Good, the Bad, and the Ugly
In the proper tradition of a software post-mortem, I’m going to say not just went well with SM 1.x, but also what went poorly. Maybe somebody can learn from it.
- It had a beautifully simple UI. I’ll defend its UI to the hills: It opens to an empty window with just a row of buttons at the top, all greyed out except for the one you’ll want to click. It’s designed to be so obvious that it doesn’t need documentation, and I think it worked, based on how so many people in so many countries had no trouble using it, even if it was in a language unfamiliar to them. I read a lot of books on UI design in the mid- and late-’90s, especially Al Cooper’s About Face and Inmates, and SM 1.x resulted from a very conscious effort to be as simple a UI as possible. It’s still faux-3D and pixelly, like most software was at the time, but its UI is conceptually elegant even despite its age.
- It did one thing and did it well. It scanned your disk and showed you which folders were eating it up. It didn’t have 10,000 features. It didn’t attempt to be everything to everybody. It had the one feature that everybody needed.
- As it turned out, my problem was everybody else’s problem too. There’s a counter-intuitive notion in software that the best designs result from not designing for the many but designing for one. I built a piece of software that solved my problem and then I gave it away, and it turned out that a million other people had the same problem and wanted exactly that tool to solve it.
- It was free. I can’t really overstate how much of a difference this made. Everybody everywhere could get it, and they did. I didn’t make a buck off SM 1.x, but even today it can be found all over the world. In some ways, it’s tempting to wonder what might have happened had I followed the open-source model with it: Would it have grown, or would it have floundered? (This was long before Git or Mercurial or distributed version control!) Would there have been other contributors, or would that effort have been a waste? It’s hard to say, but at least it was free.
- Building it on MFC. To this day, my opinion of “development frameworks” is colored by my MFC experience. I chose MFC at the time because it was this big development framework that Microsoft was proselytizing, this thing that everybody was using, that was The One True Way to code things for Windows.
Boy, what a crock that was.
MFC was a disaster, an architectural experiment gone wrong. A generation of programmers built stuff on it, but the moment that anything better was available (Java, VB, C#, the web), they rightly all jumped ship. MFC was originally built to be “wrapper classes” to make Win32 programming easier, but somewhere along the line, it developed Strong Opinions that everything should follow a Document/View model and be architected in a certain way, and everything went downhill from there. MFC is simultaneously overbearing and under-supportive: It insists you do everything its way, but “its way” doesn’t include most of the things you need to do in real-world software.
I built SM 1.x entirely on MFC because I’d bought books on it the previous summer, and I spent most of SM 1.x’s development fighting with MFC’s constraints. If you study the source code, you’ll see that many pieces simply avoid MFC altogether and just access Win32 directly, just because of how bad and unusable the MFC classes were.
To this day, I am still skeptical (and often rightly so) of “frameworks” that promise to do everything; as Spolsky said, every abstraction leaks; and my corollary to that would be that the bigger and more complex the abstraction, the worse its leaks will eventually be when they happen. The bigger they are, the harder they kabong.
- Not continuing it. During SpaceMonger 2.x’s development, I stopped all work on SM 1.x. SM 2.x took years — it wasn’t released until 2006 — and meanwhile, there were bugs found in and features missing from SM 1.x, some of which would have been easy to do. I should’ve made some token efforts to keep it going, which would have kept rivals like WinDirStat from gaining traction in the interim. I lost a lot of good will in those intermediate years as people waited and waited and waited…
- Thinking translation was a good idea. I got complaints for years after doing the translation to French in SM 1.3.4. The text was wrong, there wasn’t enough space, things weren’t quite right — if I knew then what I know now, I’d never have released it in any language except English, because I simply couldn’t support more than one language.
- Not archiving well. The only source code that exists is SpaceMonger 1.4, because I just coded right over top of the existing source. Today, in a world full of Git version control, that’s nowhere near the problem it was then, but I should’ve made better backups of the code. Little did I know that twenty years later I’d still be talking about it.
So that’s it. SpaceMonger 1.x is long-last released as source code. It’s not perfect. It was written by a college student two decades ago, and the first version was less than a day’s effort. But it works, and maybe there are things to be learned in it by other programmers. In a future post, I’ll talk (again) about the algorithms it used, and explain how SM 2.x did it even better; but for now, having the source code and a decent story is likely good enough for one night’s efforts.
So have questions? Found a bug? Want a feature?
…heh… now, at long last, you can handle that yourself 🙂