spaghetti (western) code
In my next life, I'm going to be like Brad, who says, "I usually don't bother [doing pseudocode], or else I do extremely general pseudocode. I usually find it's not worth my effort." But, unfortunately, I've proven time and time again that I'm just not capable of carrying large amounts of logic in my head all at once—and keeping it all straight—so I've been going through the plans for Quarto, a page at a time, and creating pseudocode for them. It explains my lack of (and lousy) entries over the past few days, and I fear will explain the lack of (and lousy) entries for the next week or so. I have to admit that it's hard to write comprehensible English when your brain is trying to think in these terms: (random snip taken from the mockup for the add/edit entry page)
- if (!$invalid_date), save entry. Set ($entry_saved) on completion..
- if (!$invalid_date) && ($entry_saved)
- if (status=public) && ($ping_weblogs.com) && ($do_the_ping), ping weblogs.com. Set ($successful_ping) on completion.
- if (status=public) && ($email_on_post) && ($do_the_notify_email), send email. Set ($successful_email) on completion.
- if ($invalid_date), display all choices.
- "Error: invalid date. No notifications have been sent. Entry is not saved."
- if (!$entry_saved)
- "Error: Entry did not save properly. Try again."
- if ($entry_saved) && (!$invalid_date) && ($status != public),
- case ($do_the_ping): "Error: You can only ping weblogs.com for public entries"
- case ($do_the_notify_email): "Error: You can send email notification for public entries"
- else: "Entry $entry_id marked private/draft."
- if ($entry_saved) && (!$invalid_date) && ($status = public),
- case ($do_the_ping) && (!$successful_ping): "Error: Unable to ping weblogs.com. Try again."
- case ($do_the_notify_email) && (!$successful_email), "Error: notify-on-post email did not send."
- case ($do_the_ping) && ($successful_ping), "Weblogs.com pinged for this entry."
- case ($do_the_notify_email) && ($successful_email), "Email notification sent for this entry."
- ELSE state that the entry is now available at entrypage + querystring + entry_id
Yeah. Exactly. I know, my logic's twisted at best, but this is actually better than my first stab at it. So, now that my brain hurts, it's time to finish packing, get the car ready, and head on out so that we can make it to the dragon*con meeting. I've done ten pages full of this kind of spaghetti code this week, and I think a weekend off is well-deserved.