PRL Pmod1-L1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

PRL_PMOD1-L1&L2

PROGRAMMING LANGUAGE

PRELIMINARY MODULE

INTRODUCTION TO
MODULE
PROGRAMMING
1
LANGUAGE
MODULE PROGRAMMING
2 LANGUAGE
PROGRAMMING
MODULE
LANGUAGE
3
PARADIGM
TOP 10
PROGRAMMING
MODULE
LANGUAGE
4
(CURRENT YEAR) -
REPORTING
MODULE IN PROGRAMMING LANGUAGE
Page | 2
PRL_PMOD1-L1&L2

MODULE 1
INTRODUCTION TO PROGRAMMING LANGUAGE

LESSON 1: ABOUT PROGRAMMING LANGUAGE

WHAT IS COMPUTER PROGRAM?


A program is a set of instructions following the rules of the chosen language. 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.

WHAT IS COMPUTER PROGRAMMING?


Computer programming is the process of writing, testing, debugging/troubleshooting, and
maintaining the source code of computer programs. This source code is written in a
programming language like C++, JAVA, Perl etc.

WHAT IS COMPUTER PROGRAMMER?


A programmer is someone who writes computer program. Computer programmers write, test,
and maintain programs or software that tell the computer what to do.

WHAT SKILLS ARE REQUIRED TO BECOME A PROGRAMMER?


 Programming - Writing computer programs for various purposes.
 Writing - Communicating effectively with others in writing as indicated by the needs of
the audience.
 Reading Comprehension - Understanding written sentences and paragraphs in work-
related documents.
 Critical Thinking - Using logic and analysis to identify the strengths and weaknesses of
different approaches.
 Computers and Electronics - Knowledge of electric circuit boards, processors, chips,
and computer hardware and software, including applications and programming.
 Mathematics - Knowledge of numbers, their operations, and interrelationships including
arithmetic, algebra, geometry, calculus, statistics, and their applications.
 Oral Expression - The ability to communicate information and ideas in speaking so
others will understand.
 Oral Comprehension - The ability to listen to and understand information and ideas
presented through spoken words and sentences.
 Written Expression - The ability to communicate information and ideas in writing so
others will understand.
MODULE IN PROGRAMMING LANGUAGE
Page | 3
PRL_PMOD1-L1&L2

 Written Comprehension - The ability to read and understand information and ideas
presented in writing.
 Deductive Reasoning - The ability to apply general rules to specific problems to come
up with logical answers. It involves deciding if an answer makes sense.
 Information Organization - Finding ways to structure or classify multiple pieces of
information.

As we know, to communicate with a person, we need a specific language, similarly to


communicate with computers, programmers also need a language is called Programming
language.

Before learning the programming language, let's understand what is language?

WHAT IS LANGUAGE?

Language is a mode of communication that is used to share ideas, opinions with each other.
For example, if we want to teach someone, we need a language that is understandable by both
communicators.

WHAT IS PROGRAMMING LANGUAGE?

A programming language is a computer language that is used by programmers (developers)


to communicate with computers. It is a set of instructions written in any specific language ( C,
C++, Java, Python) to perform a specific task.

A vocabulary and set of grammatical rules (syntax) for instructing a computer to perform
specific tasks. Programming languages can be used to create computer programs. The term
programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL,
FORTRAN, Ada, and Pascal.

A programming language is mainly used to develop desktop applications, websites, and


mobile applications.

In a programming language, you eventually need to convert your program into machine language
so that the computer can understand it.

There are two ways to do this:

 Compile the program


 Interpret the program

COMPILER VS. INTERPRETER

Compile is to transform a program written in a high-level programming language from source


code into object code. This can be done by using a tool called compiler. A compiler reads the
MODULE IN PROGRAMMING LANGUAGE
Page | 4
PRL_PMOD1-L1&L2

whole source code and translates it into a complete machine code program to perform the
required tasks which is output as a new file.

Interpreter is a program that executes instructions written in a high-level language. An


interpreter reads the source code one instruction or line at a time, converts this line into
machine code and executes it.

GENERATIONS OF PROGRAMMING LANGUAGE

 The first generation languages, or 1GL, are low-level languages that are machine
language.
 The second generation languages, or 2GL, are also low-level languages that generally
consist of assembly languages.
 The third generation languages, or 3GL, are high-level languages such as C.
 The fourth generation languages, or 4GL, are languages that consist of statements
similar to statements in a human language. Fourth generation languages are commonly
used in database programming and scripts.
 The fifth generation languages, or 5GL, are programming languages that contain visual
tools to help develop a program. A good example of a fifth generation language is Visual
Basic.

MODULE IN PROGRAMMING LANGUAGE


Page | 5
PRL_PMOD1-L1&L2

LESSON 2: TYPES OF PROGRAMMING LANGUAGE

There are three types of programming language:

1. LOW-LEVEL PROGRAMMING LANGUAGE

Low-level language is machine-dependent (0s and 1s) programming language. The


processor runs low- level programs directly without the need of a compiler or interpreter,
so the programs written in low-level language can be run very fast.

Low-level language is further divided into two parts :

a. Machine Language

Machine language is a type of low-level programming language. It is also called


as machine code or object code. Machine language is easier to read because it is
normally displayed in binary or hexadecimal form (base 16) form. It does not
require a translator to convert the programs because computers directly
understand the machine language programs.

The advantage of machine language is that it helps the programmer to execute the
programs faster than the high-level programming language.

Machine Language

169 1 160 0 153 0 128 153 0 129 153 130 153 0 131 200 208 241 96

High level language

5 FOR I=1 TO 1000: PRINT "A";: NEXT I

Example:
• Let us say that an electric toothbrush has a processor and main memory.
• The processor can rotate the bristles left and right, and can check the on/off
switch.
• The machine instructions are one byte long, and correspond to the following
machine operations:

MODULE IN PROGRAMMING LANGUAGE


Page | 6
PRL_PMOD1-L1&L2

b. Assembly Language

Assembly language (ASM) is also a type of low-level programming language that


is designed for specific processors. It represents the set of instructions in
a symbolic and human-understandable form. It uses an assembler to convert
the assembly language to machine language.

The advantage of assembly language is that it requires less memory and less
execution time to execute a program.

The problem is that the computer doesn't understand the assembly code, so we
need a way to convert it to machine code, which the computer does understand.

Assembly language programs are translated into machine language by a program


called an assembler.

Example:

– Machine language : 10110000 01100001

– Assembly language : mov a1, #061h

– Meaning: Move the hexadecimal value 61 (97 decimal) into the processor
register named "a1".

2. MIDDLE-LEVEL PROGRAMMING LANGUAGE

Middle-level programming language lies between the low-level programming language


and high-level programming language. It is also known as the intermediate
programming language and pseudo-language.
A middle-level programming language's advantages are that it supports the features of
high-level programming, it is a user-friendly language, and closely related to machine
language and human language.
Example: C, C++, language

3. HIGH-LEVEL PROGRAMMING LANGUAGE


MODULE IN PROGRAMMING LANGUAGE
Page | 7
PRL_PMOD1-L1&L2

High-level programming language (HLL) is designed for developing user-friendly


software programs and websites. This programming language requires a compiler or
interpreter to translate the program into machine language (execute the program).
The main advantage of a high-level language is that it is easy to read, write, and
maintain.
High-level programming language includes Python, Java, JavaScript, PHP, C#, C++,
Objective C, Cobol, Perl, Pascal, LISP, FORTRAN, and Swift programming
language.
A high-level language is further divided into three parts -

a. Procedural Oriented programming language

Procedural Oriented Programming (POP) language is derived from structured


programming and based upon the procedure call concept. It divides a program
into small procedures called routines or functions.

Procedural Oriented programming language is used by a software programmer to


create a program that can be accomplished by using a programming editor like
IDE, Adobe Dreamweaver, or Microsoft Visual Studio.

The advantage of POP language is that it helps programmers to easily track the
program flow and code can be reused in different parts of the program.

NOTE: The advantage of POP language is that it helps programmers to easily


track the program flow and code can be reused in different parts of the program.

Example: C, FORTRAN, Basic, Pascal, etc.

b. Object-Oriented Programming language

Object-Oriented Programming (OOP) language is based upon the objects. In


this programming language, programs are divided into small parts called
objects. It is used to implement real-world entities like inheritance,
polymorphism, abstraction, etc in the program to makes the program reusable,
efficient, and easy-to-use.

The main advantage of object-oriented programming is that OOP is faster and


easier to execute, maintain, modify, as well as debug.

NOTE: Object-Oriented Programming Language follows a bottom-up approach.

Example: C++, Java, Python, C#, etc.

c. Natural language

MODULE IN PROGRAMMING LANGUAGE


Page | 8
PRL_PMOD1-L1&L2

Natural language is a part of human languages such as English, Russian,


German, and Japanese. It is used by machines to understand, manipulate, and
interpret human's language. It is used by developers to perform tasks such as
translation, automatic summarization, Named Entity Recognition (NER),
relationship extraction, and topic segmentation.

The main advantage of natural language is that it helps users to ask questions in
any subject and directly respond within seconds.

COMPARISON OF MACHINE LANGUAGE, ASSEMBLY LANGUAGE AND HIGH-


LEVEL LANGUAGE

MODULE IN PROGRAMMING LANGUAGE


Page | 9
PRL_PMOD1-L1&L2

MODULE IN PROGRAMMING LANGUAGE


Page | 10

You might also like