09-02-2022, 04:44 PM
"Well I don't give a damn about my bad reputation."
- Joan Jett, Bad Reputation
Basic has gotten a bad reputation, some of it deserved, some of it "sneering" by people who use "real" programming languages. Or they don't know, or don't realize, the Basic languages of today "are not your father's Basic." Let's look at some of the criticisms people have of basic.
- Joan Jett, Bad Reputation
Basic has gotten a bad reputation, some of it deserved, some of it "sneering" by people who use "real" programming languages. Or they don't know, or don't realize, the Basic languages of today "are not your father's Basic." Let's look at some of the criticisms people have of basic.
- Requires line numbers. Basic hasn't "required" line numbers for over 30 years. Most of the "world-class" compilers (and interpreters) support line numbers if needed, but labels may be used. It is entirely possible to write functional Basic programs without needing line numbers or labels.
- Only allows short (1 or 2 character variable names). This restriction hasn't been present in Basic for over 40 years. And variables can include the underline _ as a separator.
- Variables have to be identified by a type symbol, e.g. % for integer, $ for string, etc. This is done as a convenience, so variables can be "defined" when used, and the compiler will know what the variable is used for. It is also provided for backward compatibility. You can declare a variable as a certain type before use, (e.g. DEFINE MyName AS STRING), declare certain variables beginning with certain letters have a default data type, and can even require all variables be declared before use.
- Requires declaring assignments by using "LET" as a prefix. Developments in scanning eliminated that requirement back in the 1970s. The LET keyword is kept strictly for backward compatibility.
- Produces "spaghetti code." When programs were written on an "ad hoc" or "seat of the pants" methods, yes, you got programs that jumped all over the place, and had no consistency. But this was true of any language that lacked good control structures, had line labels, and no means other than GOTO and IF statements to choose code paths. This includes C, Fortran and Cobol. It is possible, even when all Basic had for program control and branching were GOTO, GOSUB, and IF x THEN GOTO, to write structured or cohesive programs that were more-or-less consistent in using structure in code.
- Weak or inadequate control structures. Basic has all the control structures supported by other high-level languages, including: WHILE, CASE, FOR, IF statement block, procedures (SUB) and functions.
- Lacks support for structures or records. The TYPE statement allows creation of a structured record. Fields in a structure can be accessed using the standard variable.field notation.
- You can't access external routines written in other languages. External routines can be called, and any of the common calling conventions may be used.
- No database support. Since external routines can be accessed, any database system that provides a shared library for database access can be used.
- Only supports short (<256 byte) strings. Basic supports virtually unlimited length of strings. I wrote a short (<10 line) program to double the length of a string on each iteration of a loop. After 26 iterations, I had concatenated a string that was over 130 million characters long. Not that you're likely to need to work with strings that long, it is trivially easy to handle 1K or 100K strings in a Basic program.
- No dynamic memory. Basic supports pointers, creation of dynamically allocated structures (records) using the NEW keyword. Basic supports dynamic arrays that can be shrunk or expanded.
- Is trivially easy to learn. This is a criticism? You can go online and find videos on YouTube to teach C++ in 10 hours. The fact that Basic can be picked up by a person not familiar with programming even faster than this does not mean the language is a "toy." Basic can and has been used to develop professional applications. It just happens to have a gentler learning curve than other programming languages is a strength, not a weakness. It also creates an advantage, in that once you learn one programming language, it's easier to pick up others. Basic's ease of use may make it appear to be less capable than other languages, but it is usable by professionals to actually accomplish real work.
- Can't be used for GUI applications or anything other than for text applications. Some versions of Basic support Windows forms. One supports the WXWidgets GUI framework. Others support Windows WIN32 API, or other GUI frameworks. Most Basics support line drawing and other graphical image drawing functions.
While 1
Fix Bugs
report all bugs fixed
receive bug report
end while
Fix Bugs
report all bugs fixed
receive bug report
end while