Programming Foundation
CHAPTER-3 INTRODUCING CPL AND PROGRAMMING CONCEPT
Objectives
• After this course, you should be able to understand
➢ What is computer program?
➢ What is computer programming language?
➢ Types of Programming Languages?
➢ Difference between Compiler & Interpreter
➢ Program development Life Cycle
Information Technology & Japanese Language Education Center
What is a Computer Program?
Information Technology & Japanese Language Education Center
What is a Computer Program?
➢ Computers do not understand human languages, so
programs must be written in a language a computer
can use.
➢
➢ There are hundreds of programming languages, and
they were developed to make the programming
process easier for people.
➢ However, all programs must be converted into the
instructions the computer can execute.
Information Technology & Japanese Language Education Center
Type of Programming Languages
Information Technology & Japanese Language Education Center
Machine Language
➢ A computer’s native language, which differs among
different types of computers, is its machine
language—a set of built-in primitive instructions.
➢ These instructions are in the form of binary code, so
if you want to give a computer an instruction in its
native language, you have to enter the instruction
as binary code.
➢ For example, to add two numbers, you might have
to write an instruction in binary code, like this:
➢ 1101101010011010
Information Technology & Japanese Language Education Center
Assembly Language
➢ Programming in machine language is a tedious process.
Moreover, programs written in machine language are
very difficult to read and modify.
➢ For this reason, assembly language was created in the
early days of computing as an alternative to machine
languages. Assembly language uses a short descriptive
word, known as a mnemonic, to represent each of the
machine-language instructions.
For example,
the mnemonic add typically means to add numbers and
sub means to subtract numbers. To add the numbers 2 and
3 and get the result, you
might write an instruction in assembly code like this:
➢ add 2, 3, result
Information Technology & Japanese Language Education Center
Assembly Language
➢ Assembly languages were developed to make
programming easier. However, because the
computer cannot execute assembly language,
another program—called an assembler—is used to
translate assembly-language programs into machine
code, as shown in Figure 1.3.
Information Technology & Japanese Language Education Center
High-Level Language
➢ In the 1950s, a new generation of programming languages known as high-
level languages emerged.
➢ They are platform independent, which means that you can write a program
in a high level language and run it in different types of machines.
➢ High-level languages are English-like and easy to learn and use.
➢ The instructions in a high-level programming language are called
statements.
➢ Example
➢ computes the area of a circle with a radius of 5: area = 5 * 5 * 3.14159;
Information Technology & Japanese Language Education Center
Popular High-Level Programming Languages
Information Technology & Japanese Language Education Center
What is Source code or object code?
➢ A program written in a high-level language is called
a source program or source code.
➢ a computer cannot execute a source program, a
source program must be translated into machine
code for execution.
➢ The translation can be done using another
programming tool called an interpreter or a
compiler.
Information Technology & Japanese Language Education Center
Compiler & Interpreter
➢ An interpreter reads one statement from the source
code, translates it to the machine code or virtual
machine code by line by line, and then executes it
right away.
➢ A compiler translates the entire source code into a
machine-code file at one time.
Information Technology & Japanese Language Education Center
Programming Syntax?
print out Hello to the Screen
Java C# C++ python php JavaScript
System.out.print(“Hello”); Console.WriteLine(“Hello”); Cout<<”Hello”; print(“Hello”) echo “Hello”; console.log(“Hello”)
;
get intput from the Keyboard
Java C# C++ python php JavaScript
data=scanner.next(); data=console.readLine(); cin>>data; data=input() data={$_PO data=prompt();
ST['userna
me']}
Information Technology & Japanese Language Education Center
Translate from source code to object code
Information Technology & Japanese Language Education Center
Step to develop a computer program:
1. Define and analyze the problems or
requirements
2. Design the Algorithm
3. Code/develop the Program
4. Test/Debug
5. Document/Maintainance
Information Technology & Japanese Language Education Center
Define and analyze the problem
➢ studies the problem.
➢ decides the best way to solve these problems.
Studying a problem is also necessary because it
helps a programmer to decide about the following
things:
➢ 1)The facts and figures which are necessary for
developing the program.
➢ 2)The way in which the program will be designed
➢ also, the language in which the program will be
most suitable.
➢ 3)What is the desired output and in which form it is
needed, etc.
Information Technology & Japanese Language Education Center
Design the Algorithm
➢ An algorithm is a sequence of steps that must be
carried out before a programmer starts preparing his
program. The programmer designs an algorithm to
help visual possible alternatives in a program also.
Information Technology & Japanese Language Education Center
Code/develop the program
➢ The next step after designing the algorithm is to
write the program in a high-level language. This
process is known as coding.
Information Technology & Japanese Language Education Center
Test/debug
➢ The process of executing the program to find out
errors or bugs is called test execution.
➢ It helps a programmer to check the logic of the
program.
➢ It also ensures that the program is error-free and
workable.
Information Technology & Japanese Language Education Center
What is Debug?
➢Debugging is a process of detecting, locating and
correcting the bugs in a program.
➢ It is performed by running the program again and
again.
Information Technology & Japanese Language Education Center
Document/maintainance
➢ When the program is finalized, its documentation is
prepared. Final documentation is provided to the
user. It guides the user how to use the program in
the most efficient way.
➢ Furthermore, another purpose of documentation is
to allow other programmers to modify the code if
necessary. Documentation should also be done in
each step during the development of the program.
Information Technology & Japanese Language Education Center
Program Development Life Cycle
Information Technology & Japanese Language Education Center
Homework
➢ Search the most popular Programming Languages?
➢ What can do with it?
➢ Why does it popular ?
Information Technology & Japanese Language Education Center
Thank!!
Any Questions
Reference Link
➢ http://sciencerack.com/6-steps-of-program-
development-process-with-detailed-description/
➢ http://sciencerack.com/communication-protocol/
Information Technology & Japanese Language Education Center