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.

display results:

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.

all tags: 

Comments

I guess computer science courses never taught me anything useful after all. =) I looked through my notebook for any sort of pseudocode and all I could find was one line: "break out by project id & MSBID" That's really more of a requirement than anything. I turned that into about a page of code, I think. CompSci teachers hate people like me. =)

i haent done real code in so lnog i can only thing in vague general terms like "do stuff here when that thing doesnt do the thing its supposed to" which invariable makes manny and cody (with guest appearances by dave) lecture me over the course of a week or two on the painfully intricate details of threadsafe object model inheritance theory applied to multi stage encrypted handshaking authentication protocol schemes and how that relates to the theory of the universe... or some other bizarre chunk of trivia that suck my will to live. Usually the coversation is gleefully abducted at random points by various people "work harder not smarter. and pay attention to me, i think im cooler than you" (r), "the client wants everything blue and delivery has been moved up a week. we used up all our development time, so i want this finished right away, but i think we'll have about 16 more user acceptance tests and expand the scope 48 more times today"(h), long and complex anecdotal tales of epic proportions that involve siberia and international politics and how the communist system was woefully inadaquate; the frozen tundra of the NWT; flying (specifically instrument only white-out approaches on military bases stuck on the side of some mountain with a 1000' drop off at the end of the runway, with specific attention paid to the improtanco of compensating for the catabatic wind shifts...); electronics involving zener diodes and analog cumputing devices; slide rules; space flight; harley davidson motorcycles, BMW's, and regenerative braking mechanisms for go karts; philosophical thoeries of language, comunication and context -"mappers vs. packers"; and, my all-time personal favourite: HVAC theories and the many laws of thermodynamics, specifically focusing on heat thresholds and inferior digital temperature control mechanisms that inject "overshoot" problems into the mix.... (d). This last interjection sequence is my favwourite and made things interesting... mostly because you have ot respect a guy who has been there, done that, built the factory that makes the t-shirts and still has the time to make a difference in your day... =) where was i? oh yes. pseudo code. right. i love pseudo code. but i think its because I get easily distracted and if I dont map it out first, i end up trying to finish it in three different ways and it doesnt work worcth a damn. Optimizing pseudo code is my favourite part. thats my story.

AAAAAA!!!! What do you mean you don't write pseudo-code? I suppose you don't write specs either.

Specs? Specs are for analysts. Real programmers don't write specs. =)

*sigh* I wish I could get away with not writing pseudo code. Unfortunately, my teachers would flunk me and my coworkers would strangle me if I didn't write pseudocode. Now, granted, a lot of my coworkers don't write the damn stuff, so I get to spend an extra work day just figuring out how to read the damn stuff.