3 ms·
My favorite thing about this story is that Basic was meant to be used exactly this way, for getting new programmers off the ground. And like everyone, I've got
by sevensor 11y ago
My favorite thing about this story is that Basic was meant to be used exactly this way, for getting new programmers off the ground. And like everyone, I've got fond memories. We had an IBM PS/2 80286, with a whole megabyte of memory, a 20 megabyte hard drive, and MS-DOS three point something. At some point, I discovered that it had Basic, but it didn't have a graphical editor. It had edlin, which was still enough to write programs that told their users how awesome I was. Forever, with gotos.
And for the record, I don't think using gotos as a child sabotaged my ability to write structured code later in life. "GOTO considered harmful" gets taken way out of context!
- dragonbonheur 11y agoI've always thought that learning to follow GOTOs and GOSUBs was the key to understand assembly language. "GOTO considered harmful" is really what's considered harmful. I never take anyone who says "X considered harmful" seriously because of "GOTO considered harmful".
- Jtsummers 11y ago"GOTO considered harmful" is about a style of unstructured programming that was prevalent in its era. GOTOs are certainly not harmful on their own. But they offer a power that leads to unmaintainable and unreasonable [0] code. Like the spaghetti mess that is callback hell today. Languages which offer structured constructs that are really just syntactic sugar over GOTOs are better [1]. Structured use of GOTOs are feasible. But it requires a discipline that is not found in the community at large. If you're responsible for any project involving more than yourself as the developer, you cannot assume that discipline is present. With regard to assembly, yes, the branching and jumping instructions are the gotos Dijkstra was talking about. No, he wasn't wrong. The thing is, they have to be used in a disciplined manner or the outcome is extremely fragile code. Which was one of his biggest hobby horses. He viewed programming as a branch of mathematics. Where programs could be derived from first principles. GOTOs, as commonly used, necessarily broke that process. They also make it nigh impossible to understand poorly disciplined code. Same thing with magic numbers, weak type systems, and a number of other topics. They aren't bad on their own. They're bad when used in practice because they make undisciplined code trivial to produce. [0] In the sense that the code cannot be reasoned about. [1] In a strict sense, they're equivalent. In a less strict sense, they remove or minimize the ability to make unreasonable [0] code.
- sevensor 11y agoI agree -- the whole "considered harmful" meme is long overplayed. I don't even click on links with "considered harmful" in the title. The original point, which was that GOTO abuse was letting undisciplined programmers create impossible-to-follow control structures, was true in its time. I've seen some truly headache-inducing GOTOs in 1970s-era FORTRAN that involve jumping into the middle of loops and the like. But the modern point of view that rejects GOTO out of hand is just ignorant.