Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : In Memoriam: Thomas E. Kurtz, 1928–2024
Page 1 of 2 | |||||
Author | Message | ||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1109 |
I haven't noticed mention of the passing of Thomas Kurtz here. Who? One of the co-creators of BASIC. Maybe what we are using now shouldn't have the same name as what was created 60 years ago, but I'm sure many careers came to be because of early exposure to BASIC. The Apple][ was what got me started. Thank you, Thomas Kurtz. ============== I came across the following, which I found interesting: A Sermon concerning the Divinity of Languages; or, Dijkstra considered Racist an epistle from the Rt. Rvd. Pastor Manul Laphroaig, for the Beloved Congregation of the First United Church of the Weird Machines Generating Sounds As you have seen, PEEK (-16336) clicks the speaker of the APPLE ][. POKE -16336,0 will also click the speaker, and any program which repeatedly PEEKs or POKEs the address -16336 will produce a steady tone. Figure 4: Excerpt from Apple ][ Basic Programming (1978) Indulging in some of The Pastor’s Finest, I proclaim to my congregation that there is divinity in every programming language. ———— “But,” they ask, “if there is divinity in all languages, where is the divinity in PHP? Though advertised as a language for beginners, it is impossible for even an expert to code in it securely.” Pouring myself another, I say, “PHP teaches us that memory-safe string concatenation is just as dangerous as any stupid thing a beginner might do in C, but a hell of a lot easier to exploit. My point is not in that PHP is so easy to write, as it isn’t easy to write safely; rather, the divinity of PHP is in that it is so easy to exploit! Verily I tell you, dozens of neighbors who later learned to write good exploits first learned that one program could attack another by ripping off SQL databases through poorly written PHP code. “If a language like PHP introduces so many people to pwnage, then that is its divinity. It provides a first step for children to learn how program execution goes astray, with control and data so easy to mangle.” ———— “But,” they ask, “if there is divinity in all languages, where is the divinity in BASIC? Surely we can mock that hellish language. Its line numbers are ugly, and the gods themselves laugh at how it looks like spaghetti.” Pouring myself another, I proclaim, “The gods do enjoy a good laugh, but not at the expense of BASIC! While PHP is aimed at college brogrammers, BASIC is aimed at children. Now let’s think this through carefully, without jumping to premature conclusions. “BASIC provides a learning curve like a cardboard box, in that when trapped insider a clever child will quickly learn to break out. In the first chapter of a BASIC book, you will find the standard Hello World. 10 PRINT "Hello World" “Groan if you must, but stick with me on this. In the sixth chapter, you will find something like the following gem. 250 REM This cancels ONERR in APPLE DOS 260 POKE 216, 0 “Sit and marvel,” I say, “at how dense a lesson those two lines are. They are telling a child to poke his finger into the brain of the operating system, in order to clear an APPLE DOS disk error. How can C or Haskell or Perl or Python begin to compete with such educational talent? How advanced must you be in learning those languages to rip a constant out of the operating system’s brain, like PEEK(222) to read the error status or POKE 216, 0 to clear it?” A student then asks, “But the code is so disorganized! Professor Dijkstra says that all code should be properly organized, that GOTO is harmful and that BASIC corrupts the youth.” Pouring myself another, I say “Dijkstra’s advice goes well enough if you wish to program software. It is true that BASIC is a horrid language for writing complex software, but consider again the educational value in spaghetti code. “Dijkstra says that a mind exposed to BASIC can never become a good programmer. While I trust his opinions on algorithms, his thoughts on BASIC are racist horse sh*t. “A mind which has *not* been exposed to BASIC will only with great difficulty become a reverse engineer. What does a neighbor who grew up on BASIC spaghetti code think when he first reads unannotated disassembly? As surely as the gostak distims the doshes, he knows that he’s seen worse spaghetti code and this won’t be much of a challenge! “Truly, I am in as much awe of the educational genius of BASIC as I am in awe of the incompetence of the pedagogues who lock children in a room with a literate adult for a decade, finding those children to still be unable or unwilling to read at the end. Lock a child in a room with an APPLE ][ and a book on BASIC, and in short order a reverse engineer will emerge. “There is divinity in all languages, but BASIC might very will be the most important for teaching our profession.” ———— “But,” they ask, “if there is divinity in all languages, where is the divinity in Java?” Pouring myself another, I drink it slowly. “The lesson is over for today.” Visit Vegipete's *Mite Library for cool programs. |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
basically basic is not basic. it's evolved to different versions that are incompatible and not easy to convert. for micro controllers picaxe,greatcowbasic,mmbasic converting programs is not easy. rant |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
BASIC <geological term: contains little silica> Baginners All-purpose Symbolic Instructional Code Originally designed as a programming language to teach beginners how to increment line numbers. Thanks, Stan Kelly Bootle. :) The problem doesn't lie with BASIC, Stan, it lies with the uncontrolled way in which people have modified it for different platforms. In fact, GCBASIC, MMBasic, Commodore Basic, Apple Basic and BBC Basic are so close to the original BASIC that *at that level* the code is virtually interchangeable providing you stick to single character integers. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
Hi, The 1964 basic did not provide many commands and functions. And honestly these are with minor differences still present in all Basics. The famous 10 Print "Hello World" 20 Goto 10 Is a good example. This will work in any Basic. Differences eroded from the desire to expand basic. Basic wasn't enough. Enhanced it should become, but still called Basic. Hence the lingual differences. One desired better graphics commands, others required advance math functions, some requested IO control functions. Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Yep. BASIC was never intended to interface to anything. It was designed to be used from a teletype or "glass teletype" (terminal) to teach beginners the very basic steps of processing commands. People forget what the original intention was. It wasn't a programming language at all, it was an educational tool, easier to teach than assembler. All it had to do was read a keyboard and print numbers on the screen. It's very unfair to slate "BASIC" as being a failed programming language. If the code is poor and unstructured is that the fault of the language or the programmer? You can write really bad code in C, assembler, PHP, Java or probably any of the lower level languages - the ones where you can actually get the system to do things rather than only choose commands from a list of "safe" ones. All the above are capable of trashing the OS. They can also be programmed using good structuring, making maintenance easy. "There are three things a man must do before his time is done. Write two lines of APL and make the bu66ers run!" (Devil's DP Dictionary) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 865 |
Since the mid-80s (QuickBasic, TurboBasic), for me, it has been: Brilliantly Advanced Structured Instruction Code I use lots of Basics and I don't care about the syntax differences because there is still nothing better for RAD (rapid application development) I'm not able to become a programming wizard because every day I find myself jumping from pneumatics to hydraulics to electrics to mechanics to business admin. But when I need code, at least I understand good logic/structure and most importantly, safety (I see some scary stuff from PLC "engineers") Not wanting to ruffle any feathers on TBS, I don't talk about SmallBasic but it's an awesome cross-platform interpreter that has a packager (not a compiler). If I want a Windows/Linux/RPi front-end for my Mites, this is what I'll use because I love interpreters. Documentation and support isn't great but hardly required. I have had a lot of fun over the past few decades with those who turn their nose up at Basic because I have been shipping product while they haven't gotten past first base |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 865 |
homa had it covered |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 865 |
Funny how an assembly programmer is well respected |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3802 |
Dijkstra helped a lot to get spaghetti code seen as highly undesirable. His complaint about BASIC was fair in terms of what BASIC was at the time: a stripped-down language made to fit in a resource-poor computer. Now that so many BASICs are not really Basic any more (they've got IF THEN ELSE, WHILE DO, etc), he'd perhaps be happier - not fully happy I imagine because many/most of them have quite poor data structures. (BTW I've seen well-structured assembly language. Its portability sucks, though, and it does take a lot of statements to do what would be only a few lines in a high level language.) John |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
Dijkstra was wrong. All great achievements before him used spaghetti code. In a resource (memory) poor environment this is the way to put much functionality in. Regardless the nice flow charts for the Apollo guidance computer, the actual code was spaghetti. Plenty of examples. Only when give abundant resources, a luxury, you can instruct to not use spaghetti. So his advise is to demand more resources, to avoid spaghetti. And stop about GOTO. At low level every processor has a JMP instruction, and compilers use it abundantly. But writing high level code you are not aware. These are my few Pennie’s to the discussion. Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Spaghetti code isn't necessarily bad in every case. When you are squeezing a Tiny Basic interpreter into a 1K or (if you are rich) 2K EPROM you'll discover that the richness of mis-using the Z80 registers in a tangle of code gets the job done. :) It may be virtually impossible to support and disassemblers will choke on it, but it's highly unlikely that it will ever be modified or extended anyway. GOTO can be an elegant structure when used correctly. It can make the code much simpler and easy to follow. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 865 |
Totally agree. I have a BASIC compiler that actually translates directly to asm. I wrote a piece of code involving a DO-LOOP and it was all very pretty but the generated asm code gobbled-up way more clocks than I wanted. I re-wrote the BASIC code using a GOTO (label) which translated to a JMP and the asm output was so tight that there was no-way to hand optimize it. |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
No one who has had to maintain spaghetti code would think that Dijkstra was wrong. The fact that it was the only way to write early code, or that it is used in the never-seen machine code that higher-level languages compile to doesn't argue in favor of using GOTO in large programs written for the resource-rich devices we have now. The $4 Pico is extraordinarily resource-rich compared to the early micros (not to mention what the Apollo programmers were coding on). There's no harm in a small program if a DO ... LOOP is coded as LABEL: ... GOTO LABEL, but there is plenty of harm in continuing to use that construct as programs grow larger. Of course, there are always exceptions, like when a need for speed demands assembly coding (which may use jumps) or after an unrecoverable error deep within code with many conditions. It's still best to teach beginning programmers how to structure their programs so as to avoid GOTO. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
GOTO as a loop structure is usually very bad. It's confusing and awkward unless the loops are trivial and there are much better ways. ON nbr GOTO or ON nbr GOSUB can also be extremely bad as simply being a conditional jump or call depending on the value of a variable can be very confusing. IF...THEN GOTO as a conditional selection to a few regions of code within the program can be far better and less complex than SELECT CASE. It allows a clean layout, with neat indentation without getting too many levels. Each region should end with another GOTO that sends it to the same exit point. This is what I refer to as "Structured GOTO". Each region of the program is independent of the others, in so far as it can be with global variables, and can even be loaded from a library of standard routines. By all means teach that GOTO isn't recommended, but IMHO it definitely has its place - and it more closely copies the way that low level languages work. It's fast and efficient. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
What low-level languages would those be (other than assembly language)? Certainly not C or C++. I doubt very many professional programmers writing in C use GOTO very frequently. In our particular case, there are a handful of GOTOs in Geoff's 5497 lines of MMBasic for DOS C code (in Commands.c, Functions.c, MMBasic.c, and Operators.c), and I doubt there are very many more in Peter's code or in Tom's MMB4L. If you look at best practice, GOTO is very rarely used, and it is good teaching practice to discourage its use by new coding learners. ~ Edited 2024-11-22 00:27 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9122 |
GOTO is very inefficient in MMbasic - sequential search through the program to find the line |
||||
pwillard Senior Member Joined: 07/06/2022 Location: United StatesPosts: 292 |
But... GOTO made BASIC just work... And many of the RETRO Home Computer BASIC dialects had no alternatives it. A fellow I know just recently developed a BASIC compiler for BASIC to 6890 Assembly to finally supply the original MS BASIC from the Tandy Color Computer with new options, adding features like optional line numbers, DO WHILE etc. So many of us still love Basic even though we all know about its limitations. Yeah, BASIC has GOTO, and we accept it. Other languages dropped it because they gave you better options instead. Imagine if 1964 BASIC natively understood the concept of callable 'named' procedures, for example. But it couldn't because we needed line numbers. Most people only had ASR33s at that point. Speed? Efficiency? Some people had 300 Baud terminal speeds to a mainframe in the 60's and were the lucky ones... and they were happy about it. The unlucky ones handed their stack of punch cards to an operator and returned a good while later, (days even), to see if their code ran. The sad truth about SMALLBASIC is that it was off to a great start but was basically (pun intended) swept under the rug. |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Recently I saw this remarkable saying : BASIC programmers don't die. They just GOSUB without RETURN. Matthias https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=17436 |
||||
karlelch Senior Member Joined: 30/10/2014 Location: GermanyPosts: 172 |
That'll be on my next T-shirt ... |
||||
EDNEDN Senior Member Joined: 18/02/2023 Location: United StatesPosts: 118 |
The classic example of where (and how) to properly use a GOTO is when you are writing a recursive decent parser. As you wind up the stack evaluating expressions (and sub expressions) eventually you may notice an error condition that has to be dealt with. You certainly can set flags and return to the level above where the error was noticed and check the flags there and continue to unwind the stack. Or... you can just GOTO where the parsing originated. In this case, the code is much cleaner and easier to understand. |
||||
Page 1 of 2 |
Print this page |