Sunk Cost

Sometimes it just isn’t working. We have this window of opportunity to get a first beta version of Equals shipped and, for goodness sake, it just isn’t getting done. Here’s the problem: we realized last year that delivering the iOS version first was a mistake. Instead we needed to do a web version first.

Equals is partly written in C, partly in Apple’s Objective-C, and partly in Javascript, but the Javascript code was done before either of us had any experience writing HTML5. (Read: hack job.) If we were going to do a true web version then we needed money (time) and we needed to learn Javascript so we lined up a contract job that paid us to learn it. It was painful (unstable, new platform without much documentation) and it didn’t buy us as much extra time as we would have liked, but it worked. By the time we were done we could re-write the code for Equals.

But too much of Equals code was still in Objective-C, which won’t work for the web version, so we needed to move it into C. Rick started to make the changes. He made it part way and then was interrupted by a health issue (now stabilized) and then contract work. He started again in late December. He thought three weeks.

Four weeks later and it isn’t done. In fact, Rick looks exhausted. He isn’t sleeping well and even days off don’t feel like days off because it isn’t done. Worse, every time he makes a change it breaks other code, so it is really fragile. Edge cases are killing him. He told me Monday he just stares at the code, not knowing what to do anymore.

I’ve been worried about the fragile code for a while. I’ve also been concerned about storing the notes in HTML as every browser changes it and will make it very hard to track changes some day. We needed a different approach.

The fundamental problem is that the code was written to handle text. When we added HTML, it was added as a side layer as to not disturb the functioning engine. Originally Rick was trying to strip the HTML, note the cursor position (which HTML doesn’t want to handle correctly to begin with), make adjustments as the code was changed, then add everything back in. As mentioned this wasn’t working.

So I suggested we change the approach. A la Markdown, which gave me the idea, I suggested we just replace the HTML with our own “markdown”, text that Rick could safely ignore and that we could store as a neutral format in the database. In fact, Rick realized we could use a feature from an early version of the app that we are no longer using, one that already was being ignored. The first thing Rick gets to do is rip out months of code.

Sunk cost. It doesn’t matter anymore.

Now we are back on track, I hope. Let’s hope we don’t hit any major snags. It is time for people to start using Equals.