Double check, just in case...
I found this today while trying to delete unnecessary code in a program I am updating. (Yes, I knew there would be code that was never used because I have updated a lot of code for this company). Why was I deleting code? To make it cleaner? To make it easier to read? No, because I received the following error when saving an agent in Lotus Notes: "Memory allocation request exceeds 65,000 bytes". I am sure I will run across many other things that will annoy me just as much. For now, I will waste time and post this.
'****Process Records from Table
Select Case Ucase(usrfunction)
If Ucase(usrfunction) = "NEW" Then
Print "Processing Request"
Case "ADD":Call RegisterUser(...clip...)
Case "DLT":Call DeleteUser(...clip...)
Case "RMV":Call Remove(...clip...)
I'll be the first to say TRWTF is that it is LotusScript (a.k.a. VBScript--). But, when you are a parent, even the ugliest of your children still needs fed.
I need a break.
I had to deal with Lotus Notes' horribly broken HTML rendering once. Never want to touch it again.
I'm going to stick my neck out and say I don't get what's really wrong with this.
They're deciding which function needs to be called based on some external input. Maybe it's from the UI, or maybe they're queuing up commands for later execution, etc. Aside from passing function pointers around or something, what's the better way to manage it?
(Don't know shit about Lotus Notes, or its scripting language, so maybe I'm missing something that should be implicit?)
Oh, crap. I somehow totally overlooked the redundant checking for "NEW". Nevermind.
maybe the programmer had the same problem: he wrote the CASE, completely forgot about it and typed the IF