BE EE-EC BCE Programming Languages Pratibha Saraf
BE EE-EC BCE Programming Languages Pratibha Saraf
An organized list of instructions that, when executed, causes the computer to behave in a predetermined manner.
Without programs, computers are useless.
A program is like a recipe. It contains a list of ingredients (called variables) and a list of directions (called
statements) that tell the computer what to do with the variables. The variables can represent numeric data,
text, or graphical images.
There are many programming languages -- C, C++, Pascal, BASIC, FORTRAN, COBOL, and LISP are just a few. These
are all high-level languages. One can also write programs in low-level languages called assembly languages,
although this is more difficult. Low-level languages are closer to the language used by a computer, while
high-level languages are closer to human languages.
The hierarchy of programming languages contain various types of programming languages. Through the first four
decades of computing, programming languages evolved in generations. The first two generations were low-level
and the next two high-level generations of programming languages.
The higher-level languages do not provide us greater programming capabilities, but they do provide a more
sophisticated programmer/computer interaction. In short, the higher the level of the language, the easier it is to
understand and use. For example, in a fourth-generation language, you need only instruct the computer
system what to do, not necessarily how to do it.
1. Readability: A good high-level language will allow programs to be written in some ways that resemble a quite-
English description of the underlying algorithms. If care is taken, the coding may be done in a way that is
essentially self-documenting.
2. Portability: High-level languages, being essentially machine independent, should be able to develop portable
software.
3. Generality: Most high-level languages allow the writing of a wide variety of programs, thus relieving the
programmer of the need to become an expert in many diverse languages.
4. Brevity: Language should have the ability to implement the algorithm with less amount of code. Programs
expressed in high-level languages are often considerably shorter than their low-level equivalents.
5. Error checking: Being human, a programmer is likely to make many mistakes in the development of a computer
program. Many high-level languages enforce a great deal of error checking both at compile-time and at run-time.
6. Cost: The ultimate cost of a programming language is a function of many of its characteristics.
7. Familiar notation: A language should have a familiar notation, so it can be understood by most of the
programmers.
8. Quick translation: It should admit quick translation.
9. Efficiency: It should permit the generation of efficient object code.
10. Modularity: It is desirable that programs can be developed in the language as a collection of separately
compiled modules, with appropriate mechanisms for ensuring self-consistency between these modules.
11. Widely available: Language should be widely available and it should be possible to provide translators for all
the major machines and for all the major operating systems.
Generation of Languages
1GL or first-generation language was (and still is) machine language or the level of instructions and data that the
processor is given to work on (which in conventional computers is a string of 0s and 1s).
2GL or second-generation language is assembler (sometimes called "assembly") language. A typical 2GL instruction
looks like this:
ADD
An assembler converts the assembler language statements into machine language.
3GL or third-generation language is a "high-level" programming language, such as PL/I, C, or Java. Java language
statements look like this:
public boolean handleEvent (Event evt) { switch (evt.id) {
case Event.ACTION_EVENT: {
EXTRACT ALL CUSTOMERS WHERE "PREVIOUS PURCHASES" TOTAL MORE THAN $1000
5GL or fifth-generation language is programming that uses a visual or graphical development interface to create
source language that is usually compiled with a 3GL or 4GL language compiler. Microsoft, Borland, IBM, and other
companies make 5GL visual programming products for developing applications in Java, for example. Visual
programming allows you to easily envision object-oriented programming class hierarchies and drags icons to
assemble program components.
Programming paradigms
Programming paradigms are a way to classify programming languages based on their features. Languages can be
classified into multiple paradigms.
Some paradigms are concerned mainly with implications for the execution model of the language, such as allowing
side effects, or whether the sequence of operations is defined by the execution model. Other paradigms are
concerned mainly with the way that code is organized, such as grouping a code into units along with the state that
is modified by the code. Yet others are concerned mainly with the style of syntax and grammar.
Common programming paradigms include:
Imperative which allows side effects,
Functional which disallows side effects,
Declarative which does not state the order in which operations execute,
Object-oriented which groups code together with the state the code modifies,
Procedural which groups code into functions,
Logic which has a style of execution model coupled to a style of syntax and grammar, and
Symbolic programming which has a style of syntax and grammar.
When the program becomes larger, it is divided into function & each function has clearly defined purpose. Dividing
the program into functions & module is one of the cornerstones of structured programming.
In OOP, data cannot move easily from function to In POP, the most function Data Access
function, it can be kept public or private so we can uses Global data for sharing that
control the access of data. can be accessed freely from
function to function in the
system.
OOP provides Data Hiding so provides more security. POP does not have any Data Hiding
proper way for hiding data so
it is less secure.
In OOP, overloading is possible in the form of Function In POP, Overloading is not Overloading
Overloading and Operator Overloading. possible.
Example of OOP are: C++, JAVA, VB.NET, C#.NET. Example of POP are: C, VB, Examples
FORTRAN, Pascal.
The core of the pure object-oriented programming is to create an object, in code, that has certain properties
and methods. While designing C++ modules, we try to see the whole world in the form of objects. For
example, a car is an object which has certain properties such as color, the number of doors, and the like. It also has
certain methods such as accelerate, brake, and so on.