Programming and Languages
Telling the Computer What to
Do
Programming
- A program is a set of step-by-step instructions
that directs the computer to do the task you want it to do and
produce the results you want.
- A programming language is a set of rules that
provides a way of telling a computer what operations to perform.
The Programming Process
- Define the problem.
- Plan the solution.
- Code the program.
- Test the program.
- Document the program.
Flowcharts
- A pictorial representation of an ordered, step-by-step solution
to a problem.
Pseudocode
- An English-like language with few set rules to aid the programmer.
- Often personalized by the programmer.
Coding the Program
- The programmer translates the logic from the flowchart or
pseudocode to a programming language.
- Must follow syntactical form of the language.
Interpreted vs. Compiled Languages
- In interpreted languages, instructions are carried out one
at a time as they are executed.
- In compiled languages, the program is translated as a unit
to form a machine language program that can be executed all at
once.
Interpreted Languages
- Alerts users to errors in statement at time of execution.
- Allows the user to execute a single statement before it is
included in the program.
Compiled Languages
- Original program is called the source program.
The machine language form is called the object code.
- Once it is translated into object code, it is linked with
small, standard procedure programs called library routines
.
- Executes faster than interpreted programs.
Testing and Correcting the Program
- Rarely does a program run flawlessly the first time it is
run. If there are errors or "bugs", they
must be corrected.
- Errors can occur in the use of syntax or in the logic of the
program.
- Syntactical errors are usually caught by the program that
translates the high-level language program into machine language.
- Logical errors are often found by using test data to see if
the program does what it is supposed to.
High-Level vs. Low Level Languages
- Low-level languages (first and second generation
languages) provide binary instructions for the computer to execute.
- High-level languages (third generation languages)
use English-like instructions that cause the computer to carry
out binary commands. They work at the level of the programmer
rather than at the level of the machine.
Low-Level Computer Languages
- Machine Language (1st Generation Languages)
- Expressed in binary, octal, or hexadecimal numbers.
- Depends on the kind of computer chip.
- Assembly Language (2nd Generation Languages)
- Expressed in abbreviations of commands.
- Depends on the kind of computer chip.
- User has complete control over the computer's operations.
- Executes faster than high level
FORTRAN
- FORmula TRANslator.
- First high-level language, released in 1956.
- Designed for scientific, mathematical, and engineering applications.
- Compiled language - once compiled, extremely fast execution.
COBOL
- COmmon Business Oriented Language.
- Released in 1960 to meet the data processing needs of business
and government.
- More software has been written in COBOL than any other language.
- Very similar to English - easy to maintain, but very wordy
and repetitive.
- Compiled language.
BASIC
- Beginner's All-purpose Symbolic Instruction Code.
- Designed to be easy to learn, yet retain the formula translation
characteristics of FORTRAN.
- First used in 1964.
- Current versions are much more powerful than early, simpler
versions.
- Very popular on personal computers.
- Interpreted language, but compilers are available.
Pascal
- Developed as a teaching language.
- First released in 1971.
- Programs must be written in a manner that meets accepted programming
standards. Enforces structured programming.
- Now used for commercial applications as well as for teaching.
- Most versions are compiled, but an interpreted version is
available.
C
- Developed at Bell Labs in 1974.
- Produces machine-language code that executes extremely fast.
- Allows a high degree of control over the machine.
- Easily portable among computers and operating systems.
- Many commercial programs are written in C.
- Compiled language.
Very High-Level Languages
- Often known as fourth-generation languages (4GLs).
- Move the programmer even further away from the machine-code
level than high-level or third generation languages.
- They are usually nonprocedural - a user need write only what
is to be done, not how.
Natural Languages
- Natural languages are closer to everyday human languages.
- Natural languages excel at easy data access and are most commonly
used to interact with databases.
Object-Oriented Programming
- Use objects (self-contained items that combine data and algorithm)
instead of structured programming.
- Object-oriented programming languages:
- Smalltalk
- C++
- Turbo Pascal