foreach

Nick Sabalausky via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 16 11:36:29 PDT 2014


On 6/16/2014 1:50 PM, H. S. Teoh via Digitalmars-d wrote:
> On Mon, Jun 16, 2014 at 01:30:02PM -0400, Nick Sabalausky via Digitalmars-d wrote:
> [...]
>> Yes. I can understand the whole "goto error" thing in a VB codebase
>> since, just like HS Teoh's C example, it's often the only clean-ish
>> way to handle errors in VB (Talking pre-.NET here, of course). The
>> examples I was referring to were just general logic. And the
>> "...statements..." sections were HUGE! Several hundred lines, and not
>> always indented correctly IIRC. So it wasn't anything obvious-looking
>> like the example.
>
> I have seen 600+-line (and bigger) functions in "enterprise" production
> code.

We regularly hit VB6's function size limits. Did you know VB even *had* 
built-in limits on function size? I didn't until I worked there ;)

> I've also seen functions called do_everything() and doit(), where
> parameters are passed via global variables (instead of, y'know, language
> built-in function parameters). Or, on the flip side, functions with
> 10-15 parameters, each of which influences which subset of the others
> actually have any effect.

At the same place, there was one particular section of code inside a 
gigantic function, and another gigantic function it was calling, that I 
wasted several days trying to figure out how the hell it actually 
worked. Eventually I realized something: The strangely-located function 
named "save[somethingOrOther]" was *loading* data, not saving.

That was a decade ago and I still can't get over it.

We would also build HTML output like this:

' An array of strings:
output(12) = "some HTML"
output(13) = "more HTML"
output(371) = "blah blah HTML"
output(47) = "other HTML"
'...
'...maybe a couple lines of logic inserted here...
'...
output(50) = "junk junk"
output(52) = "junkedy junk"
output(8) = "blort"
print join(output)

Note the sensible and orderly numbering scheme.

The whole place was like its very own TheDailyWTF site, both code and 
management.



More information about the Digitalmars-d mailing list