Getting Creative with Sports

I’m writing a story with a lot of swimming in it — specifically swimming under water. It got me to thinking about things that have nothing to do with the story, about swimming and sports and whatnot. I knew some competitive swimmers back in the day, and I remember watching one of those guys traverse nearly the entire length of the pool without breaking the surface. That was a long time ago.

Less long ago, I read that in swimming competitions the rule makers now mandate that swimmers have to come to the surface a specified distance after they dive in or after they turn. Why? Because all that splashing on the surface slows you down. Underwater is faster.

The Swimming Czars put rules into effect because swimmers will otherwise exploit the limited size of the swimming pool and spend half their time submerged. Understandable, but… you want to know who does the butterfly fastest? Put them in a nice, calm lake and point to a buoy.

Maybe this has already happened, but I think swimming can learn from the biker kids over at the velodrome. I went to a few events when I lived in San Diego, and those bicyclists have some crazy competitions (motorcycles on the course, unknown race length, slingshot your team mate, it goes on). If there’s a way to cheat, the riders at the velodrome will have a competition to see who does it best. It’s actually a lot of fun to watch, even if you don’t understand everything that’s going on.

If the lords of the swimmin’ hole adopted that ethic, there would have to be a competition that disallows breaking the surface except on turns. I think that would be hugely entertaining. You have the best conditions for world-record times, but swimmers only get to take a breath once every fifty meters. Mess up your turn and don’t get a full fresh lungful, and you’re in a world of hurt for the next fifty.

I encourage the ruling bodies of every sport to consider events like this. Body-checking in a marathon? Making sounds in golf? Team bowling? We could revolutionize sport itself!

The Devil, the Pandemic, and Me

I am imagining right now sitting in a quiet place, drinking beer, and realizing that the devil is there as well, hunched over his own brewski.

Chances are Old Nick doesn’t want to be bothered, but eventually I would have to say something. I can’t help it. “Hey,” I would say, “If I could point to one person and you made him sick, you could make me sick, too.”

The devil, I imagine, would ponder this for a moment before shaking his head. “Nah. The guy you’re thinking of sends me a lot of business.”

Where There’s Smoke…

I was pondering this morning how I could best describe for y’all the terrible, horrible, no-good, very bad five miles that were the end of my bike ride a couple of days ago. Today’s plan was to get a happier ride in before it got too hot, then have a beer or two and regale you with my story of (rather mild) heat stroke.

I have been craving protein since that ride and I was in the kitchen piling up turkey and cheese on my sandwich when The Official Sweetie of Muddled Ramblings and Half-Baked Ideas said, loudly, “Jerry! Come here RIGHT NOW!” In our many years together, I had never been summoned that way before. I dropped the mustard and hurried to find her. I rounded the corner to see the laundry room filling with white smoke.

Both the washer and the dryer were running, and I unplugged them both as one smoke detector after another began to tell us what we already knew. For one heart-stopping moment it seemed that the smoke was actually coming from the garage, but eventually we opened things up and while the dogs cowered from the terrible noise we vented the smoke and things calmed down.

It wasn’t clear at first which appliance had been smoking; but when we opened the dryer smoke came rolling out. “Can you fix it?” Official Sweetie asked, and after some thought I figured I probably could. Fundamentally, dryers aren’t that complicated.

Eventually we restarted the washer and very quickly realized what the problem was. “It’s never made that sound before,” OSMR&HBI said. Our washer was toast. The dryer had filled with smoke as it pulled air in.

Washers like ours have a complex gear box that, when driven by an electric motor, can move the tub and the agitator thingie in a complex motion. My best diagnosis is that the gearbox seized up, and the motor was burning itself up trying to turn it. Time to find some new parts.

This quest was made more difficult because the number on the cover of the manual wasn’t the model number of the washer, but was in fact the part number of the manual itself. Because that’s obviously the most important piece of information a customer might want to know. For a while it seemed that there were no parts for this washer anywhere.

It took me a while to find the actual model number of the washer, first because the plate with that information was well-hidden behind the lid, and second because there was no way to read that information while the lid was open. It took several tries with my phone camera to get a shot from inside the tub while the lid was mostly closed that captured the model number legibly.

Armed at last with the right model number, I was able to look up the parts. Gearbox for sure, and given the amount of electrical insulation that had been turned into a toxic cloud, it seemed a fair bet that the motor would need replacing as well. Cost of parts: $350 after I shopped around a bit. (The gearbox replacement part was an update to the version in our washer, and is used by literally dozens of washers from all the major brands.) Add to that cost a few hours of cursing and bloody knuckles.

New washer: $550-ish. The Official Sweetie set to shopping.

I don’t know if you guys have heard about this Pandemic Thing, but it leads to a lot of uncertainty about just when a product you buy might reach your doorstep. There is no uncertainty at all about whether the product will be brought inside the house. Availability of washers ranged from weeks to months, the delay inversely proportional to the desirability of the machine.

We discussed for a bit whether to get “good enough” sooner, or order what we really wanted and deal with not having a washer for a while. We agreed that waiting for the right machine was better than spending the next few years with a washer we didn’t really like. (“We” in the previous sentence is only 15% me.) Official Sweetie found the right machine online at Lowe’s, but there was no indication when it would be delivered until after the purchase was made. “If it’s too long, we’ll cancel,” OS said.

It’s being delivered tomorrow.

That in itself was a shock, and ultimately a happy surprise, but it took some adjusting to. Specifically, we will have to get the old washer to the street, and haul the new one up our front steps and into the house. This sudden need for logistics and heavy lifting was as much an emotional hill to climb as it was a hassle. Not for the first time, I wished we had a good hand truck.

I’d estimate I ask, “do we know anyone with a dolly?” about twice a year — often enough that I decided it was time to buy one. Back to the Lowe’s Web site for a preorder. Subsequently I set foot in a retail store for the first time in months to snag a Milwaukee with big, stair-friendly wheels. (Even this was not entirely without challenge, as the preorder had not been filled yet when I got there. I went to pull the item myself, and I was told it was on aisle 39. I marched along, 35, 36, 37… and then the wall of the store. There is a 38 and 39, they’re just… looped back around over there.)

Home, carefully washed so I could accept the welcome of the pack, I pulled out the (not-really-that-) old washer and we rolled it to wait by the front door.

I have a few people now encouraging me to ride my bike regularly. I’m hoping “my washer caught on fire” will earn me slack for one day, at least.

A Pair of Coding Aphorisms

I write software for a living, and I take great pleasure when fixing a problem means reducing the number of lines of code in the system. In the last two days, I have come up with a couple of observations:

Every line of code is a pre-cancerous cell in the body of your application.

Now, “line of code” can be a deceptive measurement, as cramming a whole bunch of logic into a single line will certainly not make the application more robust. There are even robots that can comb through your code and sniff out overly-complex bits. But just as in humans weight is a proxy for a host of more meaningful health measurements, lines of code is the proxy for a host of complexity measurements.

But the point stands. I recently had to fix a bug where someone had copy/pasted code from one place to another. Then the original was modified, but not the copy. All those apparently-safe lines of code (already tested and everything!) were a liability, where instead a function call so everyone used the same code would have been more compact, easier to read, and much easier to maintain. There’s even an acronym for this type of practice: DRY — Don’t Repeat Yourself.

While that’s one of the more flagrant ways code bloat happens, there are plenty of others, mostly symptoms of not thinking the problem through carefully at the get-go, or not stopping to reconsider an approach as the problem is better-understood. Stopping and thinking will almost always get the project done sooner — and smaller.

One important thing to keep in mind is that programming languages are for the benefit of humans, not the machines that will eventually execute the program. If the purpose of your code is not obvious from reading it, go back and do it again. Comments explaining the code are generally an indication that the code itself is poorly written.

No software is so well-written that it ages gracefully.

I work on a lot of old code written by others, and I know people who work on old code written by me. In some cases, the code was shit to start with, but in others time has simply moved on, requirements have changed, and the code has been fiddled and futzed until the pristine original is lost to a host of semi-documented tweaks.

Naturally no code I have ever written falls into the “shit to start with” category (how could you even think that?), but that doesn’t mean the people who have to maintain that old stuff won’t be cursing my name now and then, as some clever optimization I did back in the day now completely breaks with a new requirement I didn’t have to deal with at the time.

And sometimes even if the code itself is still just fine, the platform it runs on will change, and break stuff. Jer’s Novel Writer was pretty elegant back in the day, but now when I compile I get literally hundreds of warnings about “That’s not how we do things anymore.” Some parts of JersNW are simply broken now. When I no longer work where I do, I will likely rebuild the whole thing from scratch.

Speaking of work, I am very fortunate to work in an environment that allows us to trash applications and rebuild them from scratch every now and then. Having a tiny user base helps in this regard. And as we build the new apps, we can apply what we’ve learned and maybe the next system will age a little better than the one before. Maybe. But sure as the sun rises at the end of a long day of coding, someone will be cursing the new system before too long.