Saturday, February 27, 2010

It's Just One Little Button....

If you've been to a letterboxing event recently, you've probably noticed that convenient little button that allows you to record the finds for all of the personal travelers and event boxes that attend an event. There's a similar button for LTC swaps, so you can record the finding of large number of boxes from one easy and convenient page.

This is another of those examples of a feature that never seems to end. First, people requested the ability to leave a comment with each of the boxes they found. It's a reasonable idea, and I actually did implement that for the LTC swaps. Only 'private' comments are allowed, though. And as soon as I did implement that, the next feature request started coming in--"I want to post my comments publicly."

Again, it's a reasonable request, and one I want to implement, but it turns out the process is remarkable hard to implement. "It's just one little button," I'm told, "how can that possibly be hard? Public or private. Seems pretty simple to me."

This morning, I started working on this "simple" little request. About 12 hours ago. And I'm still nowhere near to being done. How can something so simple be so hard?

Options. Preferences. Notifications. As the finder of a box, you want the option to have a comment posted publicly or private. Each individual owner of the box wants the option to completely reject public comments, moderate comments, or auto-approve comments.

So already, we now have six possible combination of options that all need to work:

You: Public - Them: auto-approve
You: Public - Them: moderate
You: Public - Them: reject
You: Private - Them: auto-approve
You: Private - Them moderate
You: Private - Them reject

It's like a little battle--your options vs their options, and the lowest common denominator wins. If you want it private, the comments will be private. If you want them public, it will either be auto-approved, moderated, or forced to be private.

But since you're recording the finds and making comments on large numbers of boxes, the each box has a different set of  "their" options. You might want all of your comments to be public, but some people will want the comments auto-approved, some will want them moderated, and some of them will force it to be private. So I have to check each of the options for each box you leave a comment on.

How do I display this form? Do I tell you each person's individual settings so you know what will become of your comment--auto-approved, moderated, or rejected? Or just figure it out in the background and not confuse people with all that information.

And what if you leave some comments that you want public and others that you want private. Should I have a public/private option for every single box listed, or just one setting at the top of the page that will be applied to all of the comments?

Once all that is figured out, AQ needs to send out notifications to the interested parties. Some people want to be notified of all finds, even if no comment is left. Some people only want to be notified if there's a comment included. So AQ needs to look up the author, planter, owner, all carvers, and all contacts for each box you found--regardless of whether or not you left a comment--and AQ mail all of them (if you left a comment) or some of them (if you did not leave a comment).

It's enough to make my spin. It's spinning right now, in fact. =)

And, if I don't write the code well, it could cause the find report to generate hundreds or even thousands of hits on the database, causing the submission to appear "stalled," which might cause someone to submit the form again--just in case--making the problem worse and generating multiple notifications and comments for the same box.

So when I first created that "record finds" page, I took the easy way out. You could record finds, but no comments. At the time, comments didn't really seem that important anyhow. We're talking about personal travelers, event boxes, and LTCs. Typically, they consist of messages like, "That's a great stamp!" or "Thanks for the LTC!" or maybe "I really enjoyed meeting you at the event!" It's not really particularly useful information. Compare to the types of comments you might see on a traditional boxes such as "The logbook is full and needs to be replaced" or "The stamp is missing." That's the sort of information future finders of the box may very well want to know. It's a source of information, rather than the complimentary salutations of the non-traditional boxes.

So I took the easy way out. I just didn't support comments on those pages.

Eventually, I added comments to the LTC swap, but only allowed private ones. That was remarkably hard to do in itself, so I wasn't especially excited about the prospects of doing the same for the event finds. But even that still doesn't reach the ideal that everyone really wants to see--comments, with the option to make them public or private.

But this morning, I woke up, and was determined to get this ideal done today. Ate some breakfast, then got to work. Stopped long enough to eat some cold pizza from the frig for lunch. I'm at my mom's house and she made spaghetti for dinner (and cookies for dessert!). But otherwise, I've been working. Working. Working....

And twelve hours later, I'm nowhere close to being done. Things are so wrecked on my development machine, I don't dare upload any minor bug fixes or tweaks since there might be code that's no longer compatible with all of the other code currently on the live site.

I'll get through it--eventually. I decided to go with the "simplified form" where you specify the private/public option that is applied to all of the comments you make rather than allowing you to pick them on a case-by-case basis. I figure if you really wanted to make some comments public and some private, you'd just use the Record Finds page twice--one for each option.

And I have finally managed to get that unwieldy beast partly under control--the comments are being correctly logged and stored into the database. The part that still does not work is the notifications. I've been thinking about possibly making some shortcuts there. Maybe I could just notify the owner, rather than all "interested" parties? That would certainly make some things a lot easier. I'm rather dissatisfied with the AQ mail notifications of box comments as it is, and wonder if I should create a "Box Comments" page that allows you to review the comments on all of your boxes at once, allowing you to delete or approve them as necessary. Link to that and be done with it. I could even make a list of  "Recent Finds on My Boxes" that people can link to, and stop sending AQ mail notifications for finds without comments. If you want to see who's found your boxes, you'd still be able to look it up easily. And then I when a comment isn't left, I don't have to figure out which "interested parties" should get the notification and which ones should not.

But the I think, "But a lot of people won't like that." No, they won't. They like being notified every single time someone finds one of their boxes. Immediately. Even if there's no comment with it. It's purely selfish motives that make me think this way. "It's easier to code. It's easier to maintain. It gives me more time to play FarmVille." (I'm just kidding on that last one--after I reached level 70, I rarely get on FarmVille anymore.)

Anyhow, if you've ever wondered why I didn't do something so "obvious" as allowing people to leave comments on those pages of mass find recordings, that's the reason. It's hard! Brain-numbing hard. I figure I've already committed too far to stop now, so I'll carry through with something. It may not be perfect, and it may take several more days of work, and it might make me cry, but eventually I'll get something done. It may not be everything you want, but hopefully it'll be better than before. Options and preferences really muck up a lot of otherwise beautiful code.

I'm sometimes rather resistant to adding new options and preferences, and that's largely the reason. It makes things more complicated. Unless a sizable number of folks are actually going to use a certain preference, I often don't consider the effort involved worth the headache.

In somewhat related-but-not-really news, I started reading a book yesterday called Don't Make Me Think. Seems strange that I'd end up doing so much thinking today.

And in completely unrelated news.... I've heard nobody complain about the "shadows" on Atlas Quest bothering anyone today. Is that because I toned down the shadows, or because y'all got tired of complaining about the shadows? =)


Anonymous said...

Hang in there, Ryan. You can do it!

Rah, rah, rah,
Sis, boom, bah,
Buttons on call,
Taking a fall,
Ryan to the rescue,
For one and all!!

And the crowd goes wild!
Nice choice of clip art.

jlevesque said...

Your hard work makes AQ the excellent web site that it is. I am rather new to LB but have found myself drawn to the site with increasing frequency, given that I'm on the site EVERY day I felt I had to become a PM in support of your work. Keep it up, I have learned SO VERY MUCH about LB from your site alone. I'm completely addicted, in awe, appreciative, Hail O'Green Tortuga. Bunny Rabbit

1SG said...

There is an old saw about programing to the effect of "Expect to spend one writing some simple code then 6 hours debugging it!"

Maybe I'm weird but I liked the shadows as they were. Oh well.

Janet (mom of J A K) said...

I want to push the HUG button over and over... especially after our AQ message board conversation about this option!!!!! Thanks for working on it... sorry its been such a difficult process :o)

Anonymous said...

Don't Make Me Think! seemed like an excellent book.

And I just noticed on Amazon a listing for Rocket Surgery Made Easy.... with a 2010 copyright date.