You are on page 1of 27

Picture Analysis

Introduction to Computer
Programming

Prepared by: Kevin L. Belvis


Computer Teacher
Computer Programming

 Computer programming is an act of writing computer programs, which are


a sequence of instructions written using a Computer Programming Language
to perform a specified task by the computer.
 A computer program is also called a computer software, which can range
from two lines upto millions of lines of instructions.
 Computer program instructions are also called program source code and
computer programming is also called program coding.
 These set of rules or instructions that instruct the computer what to
perform is done through programming languages.
Programming Languages
 There are hundreds of programming languages, which can be
used to write computer programs and these are following:
Python

Java

C

C++

PHP

Perl

Visual Basic
Generations of Programming Languages …
Programming Languages

 Various programming languages enable people to tell computers


what to do
 Foundation for developing applications
Programming Languages

1. Machine Language (first generation)


 The computer’s ‘native language’
 Composed of binary digits (0s, 1s)
 Eg. 0110 1001 1010 1011
 The only language that computers understand
2. Assembly Language (second generation)
 One-to-one correspondence to machine language
 Somehow more user-friendly than machine language (mnemonic
rather than binary digits)
 Eg. ADD X Y Z
 Assembler – program that translates an assembly language program
Programming Languages

3. Procedural Languages (third generation)


 One instruction translates into many machine language
instructions
 Programs describe the computer’s processing step-by-step
 Closer to natural language; uses common words rather than
abbreviated mnemonics
 Examples: C, C++, Java, Fortran, QuickBasic
 Compiler - translates the entire program at once
 Interpreter - translates and executes one source program
statement at a time
Programming Languages

4. Nonprocedural Languages (fourth generation)


 Allows the user to specify the desired result without having to specify
the detailed procedures needed for achieving the result
 Example: – database query language - SQL Can be used
by non technical users
5. Natural Language Programming Languages
 (fifth generation (intelligent) languages)
 Translates natural languages into a structured, machine-
readable form
 Are extremely complex and experimental
Current Programming Languages

1. Object-Oriented Programming Languages (OOP)


 based on objects – packaging data and the instructions about what to
do with that data together
 Examples: Java, C++

2. Visual Programming Languages


 Used within a graphical environment
 Examples : Visual Basic and Visual C++
 Popular to non technical users.
Current Programming Languages

1. Hypertext Markup Language (HTML)


 standard language used in World Wide Web
 contains text, images, and other types of information such as data files,
audio, video, and executable computer programs
2. Extensible Markup Language (XML)
 Improved on web document functionality
3. Virtual Reality Modeling Language (VRML)
 a file format for describing three-dimensional (3D) interactive worlds
and objects
 can be used with the World Wide Web
Levels of Programming Languages …
High-level Languages
Common programming languages include …

C C++ Java Pascal Visual Basic FORTRAN


COBOL Lisp Scheme Ada

These high – level languages


 Resemble human languages
 Are designed to be easy to read and write
 Use more complicated instructions than the CPU can
follow
 Must be translated to zeros and ones for the CPU to execute a
program
Low-level Languages

An assembly language command such as:

ADD X Y Z
 means add the values found at x and y in memory, and store the
result in location z.

Assembly language must be translated to machine language (zeros


and ones)

 0110 1001 1010 1011


Computer Programmer

 Someone who can write computer programs is called a Computer


Programmer.
 A programmer is the person who designs a program. It converts problem
solutions into instructions for the computer.
 The programmer designs the program, decides which of the programs or
set of instructions to use and tests the program to see if it is working as
designed.
Program L i f e Cycle

1. Identify the problem – this is the first step. As it gives the desired output
requirements, you are going to analyze the needs to be able to come up with a
suitable programming solution.

2. Planning the solution


 Draw flowchart – graphical representation of step-by-step
 Write a pseudo code – list down the set of instructions to be used in the program

3. Coding the program – code the program with the use of a chosen programming
language
Program L i f e Cycle

4. Testing the program


 Desk checking – mentally traces/checks the logic
of the program to make sure that it is error free.
 Translation – the programming language uses a translator to ensure that the
programmer does not violate any language rules by the chosen programming
language.
 Debugging – detecting , locating and correcting bugs (error or mistake)
5. Documentation – contains a brief narrative procces undergone by the
program, from the identification of the problem, planning the solution through
flowcharting and psuedo code, coding of the program up to the testing result.
Basic “Hello World” Program

 Hello World Program in C!  which produces the


following result :
 #include <stdio.h>
 Hello, World!
 int main() {
 /* printf() function to write Hello, World! */
 printf( "Hello, World!" );
 }
Basic “Hello World” Program

 Hello World Program in Java!  which produces the same


result :
 public class HelloWorld {
 public static void main(String []args) {  Hello, World!
 /* println() function to write Hello, World!
*/
 System.out.println("Hello, World!");
 }
 }
Basic “Hello World” Program

 Hello World Program in Python!

 # print function to write Hello, World! */


 print "Hello, World!“

 which produces the same result :


 Hello, World!
 If you notice that in the given C and Java coding examples, first we have
used compilers and then execute the program, whereas in Python program,
we have directly executed the program without using compiler. Python is an
interpreted language and it does not need an intermediate step called
compilation.
 Python does not require a semicolon (;) to terminate a statement, rather a
new line always means termination of the statement.
Uses of Computer Programs

 Nowadays computer programs are being used in almost every field,


household, agriculture, medical, entertainment, defense, communication,
and etc.
 MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are
examples of computer programs.
 Computer programs are being used to develop graphics and special effects in
movie making.
 Computer programs are being used to perform Ultrasounds, X-Rays, and other
medical examinations.
 Computer programs are being used in our mobile phones for SMS, Chat, and
voice communication.
References:

 https://www.tutorialspoint.com/computer_programming/computer_progra
mming_overview.htm
 https://www.slideshare.net/HarikaReddy115/computer-programming-tutori
al-107592495?qid=b798c654-2d25-4585-a133-23f5cd5af119&v=&b=&from_
search=2
 https://www.slideshare.net/shohelsayeed9/computer-programming-lecture-1
 https://www.youtube.com/watch?v=bjFvcFjJpE0
END OF LESSON 

You might also like