Modularity on My Honeymoon
If you hadn’t noticed, I’ve been gone for the last couple of weeks. I got married and went on a honeymoon and left the blog on auto-pilot, with scheduled cross posts of things I’d written for other blogs. I figured this was better than providing no content and hopefully the posts and social media announcements synced up closely enough that I didn’t look ridiculous.
During the trip, I didn’t think a whole lot about software, per se, but I gave occasional thought to what I might say upon my return. I think really good bloggers make cool segues out of trips and experiences. You know, like “I was gazing up at the Eiffel Tower and I couldn’t help but think of Liskov’s Substitution Principle.” I’m not that good, so I didn’t come up with anything like that. I was in France and Monte Carlo, and I ate a lot of cheese, saw a lot of sites, drank a lot of wine and spent a lot of time reading. None of that reminded me of code or software, really.
An Idiot (Me) Abroad
In fact, the only technical lessons I could relate were birthed from my own stupidity. I brought my Mac Book pro along, but, incredibly, managed to forget its charger. Upon arrival at our hotel in Paris, jet lagged, I dug the laptop out of the bag to charge and discovered that this would be quite impossible. Suddenly, the Mac’s 90% charge was an ominous harbinger of computing scarcity. I’d have to ration, what, like 3 or 4 hours of latpop usage for the entire trip?
I decided that this was a ridiculous prospect for a 2 week trip, so I used a few precious battery percentages to locate an Apple store in Paris. And, I found one… under the Louvre. I’m serious, there’s a mall under the Louvre, and in it is an Apple store. So, in I marched, knowing zero French. I found the most likely seeming charger brought it up to the floor model laptops, and pointed questioningly from the product I was holding to my model laptop. The clerk gave me a thumbs up, and then spoke to me in English, effectively rendering my ‘clever’ gesturing a comical, premature optimization.
Now I had the right charger, but I also had a bit of a conundrum. Plugging US devices into European outlets and vice versa requires adapters like these. When shopping, I looked to see if there were different version of the charger for sale, including ones that might fit USA outlets. After all, I already had travel adapters, and it would make a lot more sense for me to buy a backup Mac Book charger that works in the USA than one that works in France. But there was no distinction in the store to be seen, so I bought the only one there was.
On the way back to my hotel, I did my best to hold out the absurd hope that Apple only sells USA-shaped plugs and that everyone in Europe just buys adapters. I mean, if anyone would do something like that, it’s Apple. But, I opened it up and my slim hopes were dashed. It was made for French outlets, which came in really handy for the 2 weeks that I spent in France. But now that I’m home, it’s fairly awkward. My adapter kit has a USA adapter that I’m using for the moment, but I prefer a better solution. Fortunately, this is possible.
Lessons in Modularity
What I purchased from Apple is actually two distinct parts: the step down power adapter and an AC extension cord. On Amazon, those cost about $65 together, but in the Apple store, they sold it to me for 90 Euro with the 50% markup presumably being for the convenience of walking to the Apple store and basking in the genius. Now, the real magic happens in the power adapter itself, with the plugs just serving as peripheral implementation details, if you will.
If I want to fix my problem I can buy a replacement extension cord and this, the Apple “duck” for about $5. So, I can USA-ize my $90 French Apple adapter for only about $12. So, if I put aside the absurd price of this power adapter, it’s actually relatively cheap to appropriate this thing for a different continent. And that is good design.
It’s good design for anything, including software. In fact, this is often a core principle that I teach during coaching engagements. Design your system so that implementation details are cheap and easy to swap in and out. There are design patterns that do this (Bridge being an obvious example) and general OOP approaches as well, such as programming to an interface.
When designing systems for your users, think of the sorts of variances your users are likely to clamor for or even the sorts of variances they’re already clamoring for. I’m not advocating gold plating here. Don’t build in variances because you can — build them in if they’re valuable and build them in with alacrity if they’re valuable and low-effort to add. This is the case with Apple decoupling the “duck” from the adapter.
I’m not offering this example because it’s particularly Earth shattering. Rather, I’m throwing this out there because it’s an easy visualization mnemonic. When thinking of your software, think of Apple’s AC power adapters as a model for keeping things decoupled and flexible. If you get enough practice at this, you may eventually be able to get away with charging the kind of outrageous markups for your software that they do for their hardware.