1. ICT--.Design by : Mrs.Siti 2009
5.0 PROGRAMMING
Basic Programming Concepts
Program Development
Definition of program & program language
A computer program is a series of organized instructions that directs a
computer to perform task.
Programming language is a set of words, symbols and codes that enables
human to communicate with computers.
Programming is a creation of a set of commands or instructions which directs a
computer in carrying out a task.
Level & generation of Programming Language
Low-level Languages High-level Languages
First Generation
Ex: Machine Language
Third Generation
Ex: COBOL, BASIC, C , ADA, C++
Second Generation
Ex: Assembly Language
Fourth Generation
Ex: Report Generators, Query Language,SQL,
NOMAD,FOCUS
Fifth Generation
Ex: Natural Language,Prolog, Mercury
Programming Language Approaches
Structured Object-oriented
Use top-down model โ the whole
program is broken down into smaller
sections that are known as modules
Use object- combines data with functions
to create objects.
Translation method : assembler, interpreter & compiler
Assembler Interpreter Compiler
A computer program for
translating assembly
language
Ex: MACRO-80
Assembler, Microsoft
MASM
Is used to interpret and
execute program directly
from its source without
compiling it first.
Ex: BASIC, Logo,
Smalltalk
The source code (in text
format) will be converted
into machine code which
is a file consisting of
binary machine code that
can be executed on a
computer.
Control Structures
Selection Control Sequence Control
Execution Flow Executes statement one
by one in linear or
consecutive order
Executes different
statements for different
conditions
Usage Use when want to
execute code line by
line
Do not use the
decision symbols
Use when want to
implement decision
making process in a
program
Use the decision
symbols
Program Development Phases:
i. Problem Analysis
ii. Program Design
iii. Coding
iv. Testing & debugging
v. Documentation
Basic elements in programming :
Constants Variables Data Types Operators
Value is not
changeable
during the
course of the
program
Values can
be changed
anytime
during the
course of the
program
Integer
Ex: 18,79,21
Double
Ex: 41.5, 31.4
String
Ex: Amira, Alex
Boolean
Ex: TRUE,FALSE
Mathematical Operator:
Plus (+)
Minus (-)
Equal (=)
Divide ( / )
Multiply (*)
Use constant
when you
want to
declare
something
that wonโt be
changed
midway in
your program
execution
Use variable
to store data
that may or
will change
during the
running of
the program
Relational Operator:
Ex : >, <, =, <=, >=
Logical Operators:
AND, OR and NOT