telophase: (Default)
telophase ([personal profile] telophase) wrote2015-05-15 03:20 pm

(no subject)

actual comment i have just put into my actual code
'******************************** begin bizarre tangle of ifs DO NOT MESS WITH THE TABS OR I WILL HUNT YOU DOWN WITH SCORPIONS
I'm working with decade-old code, trying to figure out how it does what it does so I can rewrite it for my new site and AAAAUUUGGHHH the mess of if statements here.

[identity profile] selenite.livejournal.com 2015-05-15 11:10 pm (UTC)(link)
I once encountered a chunk of FORTRAN IV code . . . 22 lines, all IFs and GOTOs. Control never left that block. Wound up drawing a large diagram. Two hours later: "Oh! It's a CASE statement."

Since then I've realized you can do any control structure with IFs and GOTOs, but you don't want to.

[identity profile] telophase.livejournal.com 2015-05-16 07:05 pm (UTC)(link)
I couldn't match up the number of END IFs with the number of IFs and ELSEs, and eventually went looking online for articles on VBscript/Classic ASP to find out that VBscript has *four* types of IF statements, including one that does not require an END IF. So then I had to figure out which IFs stood on their own and which ones belonged to the END IFs. I eventually worked it out, and have them all tabbed nicely now.

There is actually a comment in the code dated April 2004 that explains that more fields were added to the database to take care of certain conditions, mostly dealing with different types of files that could be uploaded into electronic course reserves, and that the code here was kludged together. It hadn't been touched since. The last time I did the website I just ported it over without changing the way these pages were displayed. I'm changing them to be more user-friendly now, so I *have* to rewrite this code...although part of that depends on a question I have to my boss about various types of file formats that faculty may or may not be putting into course reserves any longer. I may be able to rip out giant swathes of code, since I think profs are moving to eCollege more and more for hosting files for their students to look at, so if I don't have to support it, I don't want to support it.

[identity profile] selenite.livejournal.com 2015-05-16 08:13 pm (UTC)(link)
if I don't have to support it, I don't want to support it.

I'm now visualizing blocks of code with the comments "Delete when Prof. X retires/dies," "Delete when Prof. Y retires/dies," etc.

[identity profile] tool-of-satan.livejournal.com 2015-05-15 11:27 pm (UTC)(link)
I will show you fear in a handful of Javascript.

[identity profile] telophase.livejournal.com 2015-05-16 06:57 pm (UTC)(link)
Replace that with "VBScript" and that perfectly describes this.