Basic

FIELDS OF STUDY

Programming language

ABSTRACT

BASIC is an imperative programming language that employs a linear logic format. Subroutines are integral components of a BASIC program, in contrast to functions in object-oriented language programs. Some aspects of the BASIC language facilitate errors in program code, but are normally easily amended. Modern versions of the BASIC language provide features of the object-oriented programming approach, making it more powerful and versatile. The majority of .NET developers use Visual BASIC.NET exclusively.

PRINICIPAL TERMS

The Beginners All-Purpose Symbolic Instruction Code, or BASIC, was developed in 1964 by Kemeny and Kurtz and is one of the first programming languages made available to the general public. Prior to its development, programming often required each instruction to be made as a punched card that was then fed into a card reader in sequential order as a ‘batch’ (hence the term ‘batch process’). Preparation of such programs was a specialized skill, primarily of physicists and mathematicians. Programs were run on mainframe computers such as Digital Equipment Corporation's DEC PDP-11 in universities and major businesses that had the financial resources to afford them and required specialized training in languages such as ALGOL or FORTRAN with their complex syntax and terminology. The BASIC language was developed to make computer programming accessible to anyone by employing a simple, linear program structure and familiar ‘human’ words in its instruction set. The structure of a BASIC program is very similar to the structure of an ASSEMBLY language program, which is often referred to as ‘machine language’ or ‘machine code’. The functioning of the BASIC language can therefore be understood as converting ‘human’ code into ‘machine code’.

BASIC PROGRAM STRUCTURE

BASIC is an imperative programming language that is linear in structure and entirely self-contained, consisting of a logical series of commands. Each BASIC program is essentially an algorithm designed to produce a specific type of output from the data that is provided to it. Within the main loop of the program, or source code, any number of secondary algorithms may be accommodated. Each of these is designed to carry out a specific function or calculation using the values determined or provided for an input variable. First-generation BASIC was capable of carrying out fairly complex mathematical calculations such as complex polynomials and multi-exponent relations, provided that they could be written out in tan executable format. Iterative calculations or operations are carried out using FOR-NEXT commands, and selections are made using IF-THEN-ELSE commands. The user ‘communicated’ with the BASIC program via the INPUT and PRINT commands. Comments in the program code began with the REM command, allowing the programmer to document the source code without interfering with the program function. The program commands are carried out in sequential order until encountering the END command. Each command is predicated by a line number, followed by the command instruction and the input/output (I/O) variables as appropriate. (Mainframe computers running BASIC normally used printer terminals to display the I/O of the program as hard copy.) More recent versions of BASIC incorporated more advanced features and operations, as well as object classes and structures that are typical of non-linear object-oriented programming languages.

SUBROUTINES VERSUS FUNCTIONS
SAMPLE PROBLEM

Write a simple BASIC program that accepts a value of the temperature in degrees Fahrenheit and outputs the corresponding temperature in degrees Celsius and Kelvin, then prompts for a new input value.

Answer:




PRINICIPAL TERMS

The algorithm here is to accept a numerical value from the user as the input variable, convert it to a new value, and then convert that to another new value. It then displays the calculated values, and prompts the user for a new input value. The program scans for the new input and if none is received it repeats sending the prompt and scanning for the new input until a keystroke is registered. If the keystroke is either an upper or lower case ‘’y’ as the LEFT character of the words ‘YES’ or ‘yes’, the program cycles back to the beginning and runs again. Any other keystroke fails this test and the program ENDs. The $ attached to any variable indicates a text ‘string’, and is typically called ‘string’’ instead of ‘dollar sign’.

WEAKNESSES OF BASIC

BASIC continues to be a popular and versatile language that is relatively easy to learn and to use. It does have some syntactical limitations that result in common errors. One of the most common errors made by novice users of BASIC is failing to include the END statement at the end of the program, causing the computer to idle as it awaits a next command to appear. The other major flaw is the ease with which an error in syntax can lock the computer into an infinite loop in which it performs an operation continuously without advancing the program operation. With attention to detail, however, the BASIC language is a very versatile programming language that is highly applicable in many fields.

—Richard M. Renneboog MSc

Kemeny, John G. and Kurtz, Thomas E. (1985) Back To BASIC: The History, Corruption, and Future of the Language. Boston, MA: Addison-Wesley. Print.

Kumari, Ramesh (2005) Computers and Their Applications to Chemistry. 2nd ed. Oxford, UK: Alpha Science International. Print.

O'Regan, Gerard (2012) A Brief History of Computing. 2nd ed., New York, NY: Springer-Verlag. Print.

Scott,Michael L. (2016) Programming Language Pragmatics. 4th ed., Waltham, MA: Morgan Kaufmann. Print.

Vick, Paul (2004) The Visual BASIC.NET Programming Language. Boston, MA: Addison-Wesley. Print.