Part 03 - Lesson 1 Introduction To Computer (Cont.)
Part 03 - Lesson 1 Introduction To Computer (Cont.)
A programming language is a set of commands, instructions and symbols that can be used to
interact with and control a computer. There are many programming languages such as C, C++,
Java, Python, PHP, JavaScript, or some other languages. These languages are used to design
websites, create apps, develop operating systems, control spacecraft, and analyze data.
Programming languages are necessary because computers can't understand English.
Programming languages bridge this gap by helping programmers translate their commands into
something that the computer can understand and execute.
Disadvantages:
Advantages:
Disadvantages:
• Assembler is required.
• This language is architecture /machine-dependent, with a different instruction set
for different machines.
3. Third Generation Language:
The third generation is also called procedural language /3 GL. It consists of the use of a
series of English-like words that humans can understand easily, to write instructions. It’s
also called High-Level Programming Language. For execution, a program in this language
needs to be translated into machine language using a Compiler/ Interpreter. Examples of
this type of language are C, PASCAL, FORTRAN, COBOL, C++, Java, JavaScript etc.
Advantages:
Disadvantages:
Fourth generation languages are also known as very high-level languages. They are non-
procedural languages, so named because they allow programmers and users to specify what
the computer is supposed to do without having to specify how the computer is supposed to
do it. Consequently, fourth generation languages need approximately one tenth the number
of statements that a high-level language needs to achieve the same results. Because they
are so much easier to use than third generation languages, fourth generation languages
allow users, or non-computer professionals, to develop software. Fourth generation
languages are commonly used in database programming and scripts examples include Perl,
PHP, Python, Ruby, and SQL.
Advantages:
• Easy to understand & learn.
• Less time is required for application creation.
• It is less prone to errors.
Disadvantages:
Advantages:
• Machines can make decisions.
• Programmer effort reduces to solve a problem.
• Easier than 3GL or 4GL to learn and use.
Disadvantages:
• Complex and long code.
• More resources are required & they are expensive too.
Programming languages
Programming languages are languages created for communicating with computers, through
which we give instructions to the computer to make them perform certain tasks.
These languages cannot be interpreted by the computers directly, since the language of
computers is a binary code that consists of 1s and 0s. We need to translate the programming
languages that are closer to human languages into machine code. This is done by special
translation tools called compilers.
Here are some popular programming languages: C, C++, C#, Java, Kotlin, Swift.
Scripting languages
We can define scripting languages in a way that might be hard to understand at first glance:
“scripting languages are programming languages that are being translated with an interpreter
during runtime, not with a compiler before running it.” If we want to approach it in a practical
way, scripting languages are programming languages, that are designed to make code easy to
write and modify. They are one step closer to human languages than other programming
languages, making it easier to interpret. they run much slower than other programming
languages. The reason for this “slowness” is the method of interpretation these languages use.
Here are some popular scripting languages: JavaScript, PHP, Perl, Ruby, Python.
Input The code is read as a whole The code is read line by line
Output It generates an object code between the There is no intermediate step between
input and the output
input and output
Mechanism The compilation is done before the execution Interpretation and execution are done
of the code (with a compiler)
simultaneously (with an interpreter)
Memory Needs more memory because of the object Requires a smaller amount of memory,
code
because no object code is generated
Errors Errors are displayed after compilation, all at Errors are displayed one by one, line by line
the same time
Examples C, C++, C#, Go, Java, Kotlin, Rust, Swift, JavaScript, PHP, Perl, Ruby, Python
Objective-C
Flow diagram of a program in the compilation process in C, C++
• Step 1 -- is preprocessing of header files, all the statements starting with # (hash
symbol) and comments are replaced/removed during the pre-processing with the help
of a pre-processor. It generates an intermediate file with .i file extension i.e.
a hello.i file.
• Step 2 -- is a compilation of hello.i file. Compiler software translates the hello.i file
to hello.s with assembly level instructions (low-level code).
• Step 3 -- assembly-level code instructions are converted into machine-understandable
code (binary/hexadecimal form) by the assembler. The file generated is known as the
object file with an extension of .obj/.o i.e. hello.obj/hello.o file.
• Step 4 -- Linker is used to link the library files with the object file to define the unknown
statements. It generates an executable file with .exe/.out extension i.e.
a hello.exe/hello.out file.
• Next, we can run the hello.exe/hello.out executable file to get the desired output on our
output window, i.e., Hello World!.