Serendipitous Programming

Today I’ve been working on a new feature for PocketBible for iOS and one thing led to another, and, well, I ended up implementing a feature I didn’t know I was working on, and didn’t realize how much of it was already sitting there, waiting to be exposed to the user.

So the new feature I thought I was working on is the ability to “rename” your highlight colors. That is, you’ll be able to assign a topic to each color. Then when you highlight a verse, instead of seeing a list containing “Khaki”, “Cornflower Blue” and “Hot Pink”, you’ll see “Salvation”, “God’s Love” and “Prophecy”. We’ve been wanting to implement this for a long time. While we were upgrading our cloud synchronization protocol over the last few months, I added the ability to sync highlight color names with the server and we took advantage of that in PocketBible for Windows Phone and Windows Store. The plan has always been to roll that into other platforms as we have the opportunity.

While looking through the code that shows you your list of highlight colors (which I’ll have to modify to show you your user-defined names for those colors) I stumbled into a bit of code that Jeff wrote years ago but then “commented out”. (If we have code that we’d like to retain for reference purposes but don’t want to actually have the computer execute, we turn the code into a “comment” so it will be ignored by the compiler but still be there if we want to see it.)

Those of you who have been with us for a while know that Jeff was my programming partner for 27 years before his death from cancer in May 2012. It’s been a bittersweet year as I’ve had to deal with his passing while surrounded and immersed every day in code that he wrote. I keep running into little things that remind me of him, make me want to give him a call to talk about a problem, or give me a chuckle. So it’s always interesting when I run into a piece of code like this.

What this particular piece of code did was add three additional highlighting styles to the list of colors you can highlight with. These are “underline”, “strikeout”, and “underline+strikeout”. Those look like this, this, and this, respectively.

Now, why would you ever want to strike out a verse? That’s a good question and takes me back fifteen years to the days of the Palm operating system when cameras were cameras, phones were phones, and “portable digital assistants” were all the rage. In those days, color displays were luxuries that cost money, size, weight, and battery life. So most of those devices had monochromatic screens.

On color screens, we could highlight a verse with a background color. But what could we do on these black and white screens? Since our text was coded in HTML, and since HTML offered simple styles like bold, italics, underline, and strikeout, we decided to use those. We ended up not using bold and italics because they could cause the text to re-wrap when they were applied, and in those days of wimpy processors, it just took too long and was disturbing to see. That left us with underline and strikeout, so that’s what we used.

As time has gone on, we’ve gotten to where we don’t even include these underline and strikeout highlighting styles in our programs. They’re not in PocketBible for iOS, and we weren’t planning on implementing them in PocketBible for Android. Unfortunately, some of you who were around back then and have sync’ed your highlights from your Palm PDA to PocketBible for Windows to our server and to PocketBible for iPhone expect to see those underlines. So we have to at least be able to display them if they exist, but we don’t let you create them (because we don’t want to proliferate a bad idea).

What I discovered today was Jeff’s original code for being able to create underline, strikeout, and underline+strikeout highlights in PocketBible for iOS. His comment said he had taken them out because the display engine (my code) didn’t support them. Sometime between then and now I implemented those highlight styles but we just never went back into Jeff’s code and turned those choices on.

On a whim, I enabled those lines of code and what do you know — they worked! That put me in the awkward position of trying to decide whether or not to leave them in. I never liked the idea of striking verses from the Bible, and even once you get over that, it makes the text hard to read.

About then it was time for dinner and I set the laptop aside to meet my wife and get something to eat. On the way there it occurred to me that we now have some better styling options that we had back in 1998. New versions of HTML with CSS support dotted and dashed underlines.

When I got home I spent about 30 minutes and implemented the styles you see here. These new styles replace the old styles rather than adding to them. So where you had strikeouts, you’ll have dotted underlines. And where you had strikeout+underline, you’ll have dashed underlines. I think this is a nice way of making your legacy data from your Palm days more usable and it gives you three more highlighting styles to use in PocketBible for iOS. (If you’re having trouble making out the dots and dashes, click on the screen shot to see the original size image.)

One of the cool things about this is that the underlying data storage and cloud synchronization already supports it. We’re not changing the data we save, but rather the interpretation of the data. So nothing changes in any of the other platforms nor on the server.

What I think is special about this — even though it’s not a life-changing feature — is that Jeff left it behind and it only took a little extra work to make it useful. And I like that all the infrastructure both for storing the new highlight styles and displaying them was already there.

Tomorrow I’ll get back to work on naming your highlight colors. But this was a nice little one or two hour detour to give us an unexpected new feature in PocketBible.