A language is a system of communication. A programming language is a formal constructed language designed to communicate instruction to a machine, particularly a computer. In the earlier computers, low level languages like machine language and assembly language were used. Nowadays, high level languages are used.
Evolution of Programming Language:
Evolution of programming language can be seen as: -
- First Generation (1940-50) –
- Machine Language
- Second Generation (1950-58) –
- Assembly Language
- Third Generation (1958-85) –
- COBOL
- FORTRAN
- BASIC
- PL/I
- Fourth Generation (1985 onwards) –
- C
- C++
- ALGOL
- Oracle
- Java
- SQL
Low Level Languages:
Low level languages can be classified as: -
1. Machine Language –
All digital computers work on the basics of binary numbers (0 and 1). The instructions given in binary numbers, which the computer understands are called the ‘machine Code’ or ‘Machine Language’. Machine language is the basic language but programming in this language is very difficult and time consuming. It is the only language which the computer understands without translation. Programmes written in machine language can only be used on the computer model for which that language is written. That’s why this language is called machine-oriented. It is rarely used for programming nowadays.
Merits of Machine Language –
- Efficient use of storage: language instructions and their storage in computer memory can be controlled.
- Instructions of a machine language program are immediately executable. They require no compilation or translation steps.
- Machine language instructions can be used to manipulate the individual bits in a byte of computer storage.
Demerits of Machine Language –
- Machine language is machine dependent.
- Although easily used by the computer, a machine language is difficult to program. It is necessary for the programmer either to memorise the dozens of code numbers for the commands in the machine’s instructions set or to constantly refer to a reference card.
- It is difficult to correct or modify machine language programs. To locate errors is about as tedious as writing them initially.
2. Assembly Language –
The language which substitutes letters and symbols for the numbers in the machine program is called an ‘assembly language’ or ‘symbolic language’.
Assembly Code / Symbolic Programs: a program written in symbolic language that uses symbols instead of numbers is called an ‘assembly code’.
Assembler: the translator program that translates an assembly code into the computer’s machine code is called an assembler. It is a system program which is supplied by the computer manufacturer. It is called ‘assembler’ because in addition to translating the assembly code into machine code, it also assembles the machine code into the main memory of the computer.
Source Program: a symbolic program written by a programmer in assembly language is called source program.
Object Program: after the source program has been converted into machine language by an assembler, it is referred to as an object program.
Merits of Assembly Language:
- It is not required to keep track of memory locations.
- It is efficient in terms of execution and main memory usage.
- Revision of complete program is quite easy.
- Requires fewer instructions to accomplish the same result.
- Assembly language programs are easier for people to modify than machine language program.
Demerits of Assembly Language:
- Programs cannot be executed on small size computers.
- It takes longer to code because of the more complex nature of language.
- Lack of portability of programs between computers of different makes.
High Level Languages:
High level languages were developed to overcome the limitations of low level languages. They are not machine dependent. They are problem oriented. Instructions given in high level languages are known as statements. BASIC, PASCAL, ALGOL, C are the primary high level languages.
High level languages can be classified as: -
- ALGOL (Algorithmic Language)
- BASIC (Beginners All Purpose Symbolic Instruction Code)
- FORTRAN (Formula Translations)
- COBOL (Common Business Oriented Language)
- PL/1 (Programming Language/1)
- C Language
Merits of High Level Languages –
1. Machine Independence: high level languages are machine independent. There is no need of rewriting programs if computers are changed or used of another manufacturer.
2. Easy to learn and use: very similar to languages normally used by us in our day to day life.
3. Fewer Errors: since the programmer need not write all the small steps carried out by the computer, he is much less likely to make an error.
4. It is more user friendly.
Demerits of High Level languages –
1. Lack of Flexibility: because of automatic features of high level languages and not under the control of programmer, they are less flexible than assembly languages.
2. Slow functioning: runs slower due to generality of statements. These are machine independent.
3. Lower Efficiency: as high level languages take more time to run and require more main storage, they are less efficient in the use of CPU and other facilities.
Object Oriented Languages:
Object-oriented languages are programming languages that follow the object-oriented programming (OOP) paradigm. This paradigm centres around the concept of "objects," which are instances of "classes." Objects encapsulate both data (attributes) and the functions that operate on that data (methods).
Fourth generation languages are non-procedural and object oriented in which the programmer has to instruct what to do and what not to do. With the help of these languages, programs can be developed easily.
Common Object Oriented Languages are –
1. C++: this language is developed from C language. It was developed in 1983. Although it is an object oriented language, still it has the attributes for structured programming.
2. JAVA: it was developed by Sun Micro Systems of USA. It is mostly used for internet applications. It requires JAVA compiler in the computer.
3. Oracle: it was developed by Oracle Corporation, USA. It is a non-procedural language related to RDBM (Relational Database Management System). SQL (Structured Query Language is used in Oracle.
4. SQL (Structured Query Language): it is used for database packages like Oracle, Sybase etc. it allows the easy access of the required data from database. Database editing, updating, management has been made quite easy through SQL.
Language Translators:
Any program which is not written in machine language has to be translated before it is executed by the computer.
Language translators translate the High Level Language or Assembly Language into machine language. They check for some type of errors.
Language translators are of 3 types: -
- Compiler
- Assembler
- Interpreter
OOPs (Object-Oriented Programming System):
Object means a real-world entity such as a pen, chair, table, computer, watch, etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies software development and maintenance by providing some concepts:
- Object
- Class
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
Apart from these concepts, there are some other terms which are used in Object-
Oriented design:
- Coupling
- Cohesion
- Association
- Aggregation
- Composition
Object –
Any entity that has state and behaviour is known as an object. For example, a chair, pen, table, keyboard, bike, etc. It can be physical or logical.
An Object can be defined as an instance of a class. An object contains an address and takes up some space in memory. Objects can communicate without knowing the details of each other’s data or code. The only necessary thing is the type of message accepted and the type of response returned by the objects.
Example: A dog is an object because it has states like colour, name, breed, etc. as well
as behaviours like wagging the tail, barking, eating, etc.
Class –
Collection of objects is called class. It is a logical entity.
A class can also be defined as a blueprint from which you can create an individual object. Class doesn’t consume any space.
Inheritance –
When one object acquires all the properties and behaviours of a parent object, it is known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.
Polymorphism –
If one task is performed in different ways, it is known as polymorphism.
For example: to convince the customer differently, to draw something, for example, shape, triangle, rectangle, etc.
In Java, we use method overloading and method overriding to achieve polymorphism.
Another example can be to speak something; for example, a cat speaks meow, dog barks woof, etc.
Abstraction –
Hiding internal details and showing functionality is known as abstraction.
For example: phone call, we don’t know the internal processing.
In Java, we use abstract class and interface to achieve abstraction.
Encapsulation –
Binding (or wrapping) code and data together into a single unit are known as encapsulation.
For example: a capsule, it is wrapped with different medicines.
A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.