• (nodebb)

    Wow, I wrote stuff like that when I was 7/8 years old on my C64... I always forget that a lot people basically start to develop their basic skills I gained before I was a teenage when they are adults... if they are lucky. Love the line numbers tho, really shows the complete lack of understand of what they are doing more than anything else.

  • TheCPUWizard (unregistered)

    Hey, that is advanced, and clear... they are using multi-letter variable names.... A major improvement over "single letter + optional number" naming constraints. And since no variables were scoped, there was always re-use (sometimes unintended).... just another normal day in the office back in the day...

    [MaxiTB] remember there was a time when line numbers were required for basic, and many environments did NOT have a renumber capability.... so if you numbered sequentially, and needed to insert a line, you either re-wrote everything that followed, or you replaced a line with a GOSUB [and put the removed line as the first line of the subroutine --I started just one month shy of a decade before the C64 was releases ,<grin>]....

  • (nodebb)

    This looks very much like it started as GW Basic of similar: (mostly) 2-character variable names with a type appended ($, %, #), line numbers, horrible separation of lines with ":" etc.

  • Michael R (unregistered)

    What strikes me is the "Exit Function" in FormulaControlla().

  • my name (unregistered)

    must have started way before VB or the programmer never updated his Basic knowledge (pun intented)

  • my name (unregistered) in reply to my name

    damnit intended

  • Darren (unregistered)

    Code like that - especially if it 'just works' - is like dealing with a bear. Back away slowly, don't make any sudden movements and avoid eye contact. Just leave it be and everyone will have a much happier day.

  • (nodebb)

    The fact that it's top(1) tier spaghetti code is tinged with irony, given that it's sourced from Italy.

    But yeah, I, too, wrote code better than this in Basic before Visual Basic, or even QuickBasic, existed. (Not when I was 7 or 8, naturally, since "writing code in Basic on your own home computer" wasn't a thing in 1973-4.)

    (1) "top" meaning, "at the top of a list sorted in descending order of badness," naturally.

  • Hanzito (unregistered)

    This code is already atrocious, but 2.5 million lines of it? There may be a mad programmer at work, but there are some serious Dark Forces that let that happen. They watched from the shadows and let it fester. And now they are spreading. They may manifest in your workplace and slowly consume your soul by manipulating through the Manager-Beelzebub Association.

    BEWARE!

  • (nodebb)

    The only glimmer of hope is the first line- at least they used Option Explicit, which makes variable declarations required (instead of just creating a variable anytime you use one). - The article.

    Explicit is better than implicit. *- PEP 20 – The Zen of Python

    *cries in Python*. You'd think that a language, that says "explicit is better than implicit" would not make variable declarations of all things implicit. Also, I'd love to have a const keyword or, better yet, const-by-default and a mutable keyword.

  • p (unregistered)

    I like how they seamlessly blend multiple paradigms at once: Structured IF statements and procedures with unstructured GOTOs and line numbers, and variable sigils with DIM statements.

    But in their defense, Visual Basic doesn't tell you the line number when it throws an error unless you actually put an old-school line number in the source code. So that's sort of a valid reason to put them in.

  • (nodebb)

    Some part of me wants to paste this into Notepad++ and refactor it. Someone stop me, please.

  • (nodebb)

    2.5M lines of Basic? That's, like, Necronomicon levels of madness right there.

  • (nodebb) in reply to Hanzito

    there are some serious Dark Forces that let that happen.

    Most likely the Dark Forces called "Manglement that doesn't care about how software is built so long as it works", and, in reference to:

    They watched from the shadows and let it fester.

    Those particular Dark Forces don't watch software development from anywhere, and don't have a conception of software festering.

  • LZ79LRU (unregistered) in reply to Jer

    At least he uses GOTO properly by using line numbers. That way the code is read only as any change breaks ALL the jumps in the code. Imagine you had access to 2.5 Megalines of basic code you can edit.

  • (nodebb) in reply to Jer

    LOL. I was just thinking that's how arcane spells for summoning deep space horrors might look. The programming language doesn't matter, make it arcane enough and they will heed your call.

  • Sauron (unregistered)

    Once upon a time, the Evil Codebase grew, grew, and swallowed its maintainers, one by one, feasting on their flesh, bones and suffering.

    Their screams still haunt the code as their tormented souls can't find a way out.

    The product was shipped, and it will haunt the nightmares of countless children.

  • cschneid (unregistered)

    Given the time frame, would you rather it was written in Clipper? PowerBuilder? Turbo Pascal? Smalltalk/V?

  • (nodebb)

    That code is literally breathtaking.

  • Brian (unregistered)

    I love the flow of this one. You're looking it over, see some comments like a strange incantation in a foreign language, scroll a bit further, and AAH!

  • Richard Brantley (unregistered)

    Manager: "I need you to add a new feature....OH STOP CRYING I haven't even told you what it is yet.

  • LZ79LRU (unregistered) in reply to Richard Brantley

    Real men do not cry. Real men weep.

  • LZ79LRU (unregistered) in reply to cschneid

    x86 Assembly. Accept no substitutes.

  • Railguy (unregistered)

    Here's a Halloween horror story: A VB6 mess like this also powers one of the major railroad dispatch systems in the US. It's way more than 2.5M lines. Be afraid

  • (nodebb)

    OMG. This is probably the worst code I've ever seen here, and that's saying something

  • Max (unregistered)

    There’s another horrifying reason to use line numbers in VB6: error handling. You know how modern languages have nice stack traces? In VB6 you don’t get a stack trace so much as a couple global variables. The global variable that tracks which file the error was in is fine, but the global variable that reports what line the error occurred on? Of course it doesn’t contain source file line number, it reports only the BASIC line number and so if you don’t number your lines it just reports Null all the time.

    (In work on legacy VB6 applications I refused to number lines, but I certainly have had to temporarily number a bunch of lines just to figure out exactly which was throwing an error.)

  • Foo AKA Fooo (unregistered) in reply to TheCPUWizard

    That's why any serious BASIC programmer (JK IKR) would number their lines in steps of 10, which they actually did here. As an added bonus, the line numbers not divisble by 10 obviously indicate later insertions and thus serve as a revision history, obviously obviating any need for source control.

  • (nodebb)

    My thought processes:

    That's odd, I didn't even know that you could use line numbers in Visual Basic

    I wonder why he used line numbers.

    It couldn't possible be because....

    17140   If CN% = 0 Then GoTo 17180
    

    Noooooooooooooooooooooooooo......

  • (nodebb) in reply to Steve_The_Cynic

    The fact that it's top(1) tier spaghetti code

    It's not spaghetti code. At least the fragment we see here isn't. It's actually fairly well structured, if you look at where all the gotos actually go. There's no jumping between subroutines. There's no jumping into the middle of a for loop. There's no jumping back into the middle of a logical block of code, well, not much. Most of the goats are simulating concepts from structured languages.

    Real spaghetti code like the stuff I used to write when I was 13 is vastly worse than this. Sadly I can't show you because I don't have any means of reading my Commodore PET diskettes, which some might say is fortunate.

  • Foo AKA Fooo (unregistered) in reply to Darren

    But some code is just white, to stay with the bear analogy.

  • (nodebb)

    At least this isn't Excel formulas, where even the Excel functions are translated...

  • markm (unregistered) in reply to LZ79LRU

    No, changes do not break all the GOTO's. In all versions of BASIC that allow line numbers, editing doesn't renumber the lines except when you retype a line number. So the line numbers are labels, except there's no meaning (but considering the variable names, do you think a text label would be any more meaningful?) But with every line numbered, every line may be the target of a GOTO and you have to read the whole program to find out which are. In the older versions of BASIC, I used to print the program on wide ledger paper, then draw arrows showing each GOTO or other control transfer. Imagine doing that in a 2.5M line program! (Around 400,000 pages of printout. It would fill a room, I think. Also, on a server or shared mainframe, they'd cut off your printing privileges, at the very least. That was never a problem working in TRS-80 BASIC - I expanded my RAM to the maximum of 48K of RAM, but the program size was still rather limited, and I don't remember ever running the dot matrix printer for more than half an hour at a time.)

    Oh, although the line numbers are labels, they must be sequential. Notice how most of the line numbers end in '0', but some end in '5', and one in '1'. They were originally generated (by a setting in the editor) to count by 10's so changes could be inserted between the original lines. But I am a little freaked by how few insertions there are for a program this big and this old. Either this segment of code was pre-planned remarkably well so it was never necessary to insert two lines between the original lines, or it got so messy that someone had to renumber it manually, re-typing the numbers and tracking down and editing each GOTO affected.

  • markm (unregistered) in reply to jeremypnet

    Yes, it's reasonably well structured. I can write a structured program in any language, including the many embedded control programs I've written in Assembly. I hope I've never done this, but I suspect there are coders who don't need GOTO to write an unstructured program in any language.

  • retsep (unregistered)

    Pollack might be recognizable as Polish notation so for me it seems as a parser of mathematical expressions.

  • (nodebb)

    Did early versions of VB lack an "else" or "else if" keyword? Or did the original creator not know of such advanced concepts?

  • MaxiTB (unregistered) in reply to prueg

    Yes, ELSE is a very recent addition, in fact there was no token like that in C64 BASIC. However Amiga BASIC already had ELSE... and labels and sub routines.

  • (nodebb) in reply to Foo AKA Fooo

    line numbers not divisble by 10 obviously indicate later insertions

    Meanwhile, lines Rem ---- indicate later removals (compare lines 19640-19650 and where they lead).

  • (nodebb)

    I used to write Basic code with line numbers on my Apple II back in the 1980s. (Saved on audiocassettes—no floppy drives yet.)

    I can still vividly remember the very first time I saw code with indents, semicolons, and no line numbers (it was in Pascal). No lie, my mind was BLOWN. That was a real "here's this guy living in the year 3000" moment.

  • (nodebb)

    And now you have the good idea of how our genome works.

  • (nodebb) in reply to TheCPUWizard

    Yeah, but with Microsoft Amiga Basic 1988 those days were in the past, because that one introduced labels to BASIC. So using line numbers is something really, really ancient by now.

  • Pauller (unregistered)

    Actually looks like Fortran code that was ported and not updated in any way.

  • GrumpyOldGuy (unregistered)

    And who overlooked an almost perfect wording to instead call Mr Midgely "The Man Who Sold The World" ? A missed opportunity to describe him as he was - "The Man Who Soiled The World"

  • markm (unregistered) in reply to Pauller
    Comment held for moderation.
  • ursmeili (github)
    Comment held for moderation.
  • Oliver Jones (github)

    “Lasciate ogni speranza, voi ch’entrate!”

Leave a comment on “Legacy Horrors”

Log In or post as a guest

Replying to comment #:

« Return to Article