COM 111
LECTURE SCHEDULE 13
Generation
of Programming Languages, Current Trends in Computer Programming and Languages
Programming and
Languages.
INTRODUCTION:
Computers are machines. Unfortunately they cannot understand
natural languages, such as Hindi, English, Tamil, etc. that human beings speak
and understand. Therefore, to give
instructions to computers, different languages have been developed. These languages are called computer
languages. To get a particular work done
by computers, programmers write instructions using these computer
languages. Over the last few decades,
several computer languages have developed.
Different computer languages are suitable for different
applications. For example, COBOL (Common
business oriented Language) may be more suitable for business applications,
FORTRAN may be more suitable for scientific or engineering applications. We can
classify all computer languages into three categories.
GENERATION OF PROGRAMMING LANGUAGES
First Programmer Lady Lovelace Ada Augusta (officially
the first programmer) suggested binary numbers for computer storage instead of
decimals.
1.First Generation : Machine Language
The form in which information is denoted or represented by a
combination of “1” and “0”s is called machine language. Programs and data are
ultimately represented in machine language in memory and other hardware of the
computer.
Advantages of Machine Language:
v Translation Free: Machine language is the
only language that computers can directly execute without the need for
conversion.
v High Speed: Since no conversion is
needed, the applications developed using machine language are extremely
fast.
Disadvantages of Machine Language:
v Machine Dependent: Every computer type
differs from the other, based on its architecture. Hence, an application developed for a
particular type of computer may not run on the other type of computer.
v Complex Language: Machine language is very
difficult to read and write. Since all
the data and instructions must be converted to binary code, it is almost
impossible to remember the instructions.
v Error Prone: Since the programmer has to
remember all the opcodes and the memory locations, machine language is bound to
be error prone.
v Tedious: Machine language poses real
problems while modifying and correcting a program.
2. Second Generation : ASSEMBLY LANGUAGE: As computer field advanced,
computer scientists felt the necessity of making computer programming easier.
They invented computer languages that are easy to remember and use. These
languages called assembly language uses mnemonic codes. for Example: For adding two quantities X and Y, You may
code as follows.
ADD
X Y ADD is called operation code that tells the computer what operation it has
to perform. X and Y are called operation addresses. When the program is loaded
into memory for execution the symbolic addresses are automatically converted
into actual physical addresses of operands involved in an instruction.
Assembler:
The assembly language program must be translated into machine code
by a separate program called an assembler. The assembler program recongnises
the character strings that make up the symbolic names of the various machine
operations, and substitutes the required machine code for each instruction.
Advantages of Assembly language:
v Easy to Understand
and use: The assembly language uses mnemonic codes,
for programming. So it is easier for the programmer to use assembly language
than machine language for programming.
v Less Error Prone: The programmer does not have to keep track of the storage
locations of the information and instructions. Hence , there are fewer errors
while writing an assembly language program. Assemblers also provide various
mechanisms to locate the errors.
v Efficiency: Assembly programs can run much faster and use less memory and
other resources than a similar program written in a high-level language. Speed
increment of 2 to 20 times faster is common.
v More control on
Hardware: Assembly language also gives direct
access to key machine features such as operating system kernel or micro-kernel, device drivers
and machine control.
Disadvantages of Assembly language:
v Machine Dependent: Different computer architectures have their own machine and
assembly languages, which means that programs written in these languages are
not portable to other incompatible systems
v Harder to Learn: Every type of computer architecture requires a different assembly
language, making it hard for a program
to remember and understand every dialect of assembly.
v Slow Development
Time: Assembly generated applications are
slower to develop as compared to high-level language based applications.
v Less Efficient : A program written in
assembly language is less efficient as machine language because every assembly
instruction has to be converted into machine language.
v No Standardisation : Assembly languages cannot be standardised because each type of
computer has a different instruction.
v No support for
Modern Software Engineering Technology:
Assembly languages provide no inherent support for software engineering
technology.
3. Third Generation : HIGH LEVEL
LANGUAGES (3GL)
Due to computer’s widespread usage, early 1960s saw the emergence
of the third generations programming languages (3GL). Languages such as COBOL, FORTRAN, BASIC, and
C are examples of 3GLs and are considered high-level languages.
In high-level language, programs are written
in a sequence of statements to solve a problem.
For example, the following BASIC code snippet will calculate the sum of
two numbers
LET
X =
10
LET Y = 20
LET SUM =
X + Y
PRINT
SUM
Translating
High-level Language to machine language:
Since computers understand only machine language, it is necessary
to convert the highlevel language programs into machine language codes. This is achieved by using language
translators or language processors, generally known as compliers, interpreters
or other routines that accepts statements in one language and produces
equivalent statements in another language.
a) Compiler:
Compilers Compiler is a program which translates
source code written in a particular programming language into computer-readable
machine code that can be directly loaded and executed. For each high-level language, a separate
compiler is required. For example, a
complier for C language cannot translate a program written in FORTRAN.
A
compiler is a kind of translator that translates a program into another
program, known as target language. The
complier replaces single high-level statement with a series of machine language
instruction. Once the program has been
compiled, the resulting machine code is saved in an executable file, which can
be run on its own at any time.
b) Interpreter:
Unlike compilers, an interpreter translates a
statement in a program and executes the statement immediately, before
translating the next source language statement.
When an error is encountered in the program, the execution of the
program is halted and an error message is displayed. Similar to compilers, every interpreted
language such as BASIC and LISP has its own interpreters.
Advantages of High-Level Languages:
v Readability: Since high-level languages
are closer to natural languages, they are easier to learn and understand.
v Machine Independent: program created using HLL
can be used on different platforms with very little or no change at all.
v Easy Debugging: High-level languages
include the support for ideas of abstraction so that programmers can
concentrate on finding the solution to the problem rapidly
v Easier to Maintain: The programs written in HLL
are easy to modify and maintain because HLL programs are easier to
understand.
v Low Development
Cost: The
cost of writing a HLL program is nearly constant for each line of code. Thus, a high-level language, where each line
of code translates to 10 machine instructions, costs only a fraction as
compared to program developed in a low-level language.
v Easy Documentation: Since the statements written in HLL are similar to natural
languages they are easier to understand as compared to low-level languages.
Disadvantages of High-Level
Languages:
v Poor Control on
Hardware:
High-level languages are developed to ease the pressure on programmers
so that they do not have to know the intricacies of hardware
v Less Efficient: The HLL applications are
less efficient as far as computation time is concerned.
4.
Fourth Generation : (4GL)
- It is simple, English –like syntax rules, commonly used to access databases.
- 4GLs, on the other hand, are non-procedural languages
- The non-procedural methods is simple to state the needed output instead of specifying each step one after another to perform a task.
- The non-procedural methods is easier to write, but has less control over how each task is actually performed.
- 4GLs sacrifice computer efficiency in order to make programs easier to write.
- 4GL have a minimum number of syntax rules.
- Common people can also use such languages to write application programs
- The 4GLs are divided into three categories.
1.
Query Languages:
They allow the user
to retrieve information from databases by following simple syntax rules. For
example to list only female employees .SQL and IBM’s Query – By- Example (QBE)
are examples of query languages.
2.
Report Generators:
They produce
customised reports using data stored in a database. The user specifies the data
to be in the report. Making report generators very easy to use.
3. Application Generators:
The user writes
programs to allow data to be entered into the database. The program prompts the
user to enter the needed data.
Advantages of 4GLSs:
·
A user can create an application in much
shorter time for development and debugging.
·
It does not require the programmers to
provide the logic to perform a task.
·
Lot of programming effort is saved.
·
Use of procedural templates and data
dictionaries allow automatic type checking.
·
Using application generators, the routine
tasks are automated.
Disadvantages of 4GLSs:
- Programs written in a 4GL are quite lengthy
- Need more disk space and a large memory capacity as compared to 3GLs
- These languages are inflexible
- These languages cannot directly utilise the computer power available at hardware level.
5. Fifth Generation : Very High-level
Languages :
·
These languages will
be able to process natural languages.
·
The computers would
be able to accept, interpret and execute instructions in the native or natural
language of the end uesrs.
·
The users will be
free from learning any programming language to communicate with the computers.
·
The programmers may
simply type the instruction or simply tell the computer by way of microphones.
Features
of Good Programming Language:
- Ease of use
- Portability
- Reliability
- Safety
- Performance
- Cost
- Promote structural programming
- Maintainability
- Reusability
- Concurrency support
- Provides interface to other language
- Compact code
No comments:
Post a Comment