1 INTRODUCTION.pptxAAAAAAAAAAAAAAAAAAAAAAAAAAA

EG20910848921ISAACDU 13 views 19 slides Oct 09, 2024
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

Revision


Slide Content

INTRODUCTION TO PROGRAMMING

Computer Program A computer program is a series of instructions written in the language of the computer which specifies processing operations that the computer is to carry out on data. It is a coded list of instructions that tells a computer how to perform a set of operations. It directs a computer in performing various operations/tasks on the data supplied to it. Computer programs may be written by the hardware manufacturers, Software houses, or a programmer to solve user problems on the computer. 2

Programming Programming is the process of designing a set of instructions (computer programs) which can be used to perform a particular task or solve a specific problem. It involves use of special characters, signs and symbols found in a particular programming language to create computer instructions. Programming involves the following activities; writing a program, compiling the program, running the program, debugging the programs. 3

ConT’d … A computer program performs the following: Accepts data from outside the computer as its input. Carries out a set of processes on the data within the computer memory. Presents the results of this processing as its output, and Stores the data for future use. 4

TERMS USED IN COMPUTER PROGRAMMING Source program (source code) - program statements that the programmer enters in the program editor window, and which have not yet been translated into machine-readable form. Source code is the code understood by the programmer, and is usually written in high-level language or Assembly language. 5

Terms cont’d… Object code (object program) - program code that is in machine-readable (binary) form. This is the code/language the computer can understand, and is produced by a Compiler or Assembler after translating the Source program into a form that can be readily loaded into the computer. 6

Terms cont’d… Syntax - Each programming language has a special sequence or order of writing characters. The term Syntax refers to the grammatical rules, which govern how words, symbols, expressions and statements may be formed & combined. Semantics - These are rules, which govern the meaning of syntax. They dictate what happens (takes place) when a program is run or executed. 7

Programming Languages A programming language is a set of symbols (a language) which a computer programmer uses to solve a given problem using a computer. The computer must be able to translate these instructions into machine-readable form when arranged in a particular sequence or order. Programming languages are needed to allow human beings and computers to talk to each other. Computers , as yet, are unable to understand our everyday language or, in fact, the way we talk about the world. 8

Types of Programming Languages There are two levels of programming languages; Low level languages Machine language – first generation Assembly language – second generation High level languages Third generation languages (3GLs) Forth generation languages (4GLs) Fifth generation languages (5GLs)   9

low-level languages Low level languages are closer to the machine, understood by the machine and are dependent on the machine. Features of low level languages: They are machine hardware-oriented. They are not portable, i.e., a program written for one computer cannot be installed and used on another computer of a different family. They use Mnemonic codes. They frequently use symbolic addresses. 10

Machine language (1 st Generation language) Instructions are in the form of a Binary code also called machine code (1’s and 0’s) and are called machine instructions. Machine languages are the only languages understood by computers . It is a programming language in which the instructions are in a form that allows the computer to perform them immediately, without any further translation being required. 11

Machine language Abc D 10000011100010110010100000010010100 35bits=4.bytes 8bits=1byte 1024bytes=1kb 1024kb=1mb 1024=1gb 11101 110011 1110001 11110 111000 1110000 12

Assembly Language (2 nd Generation language) Assembly Language was introduced in 1960s , also referred to second generation language. Reduced programming complexity and provided some standardization to build and applications. The 1 and 0 in machine language are replaced by with abbreviations or mnemonic code. 13

Assembly language cont’d… It consists of a series of instructions and mnemonics that correspond to a stream of executable instructions. It is converted into machine code with the help of a program translator known as assembler. Languages of this generation include IBM, BAL, and VAX Macro. These languages were still dependent on the machine they were developed on. 14

Assembly language cont’d… Common features of assembly language include: Mnemonic code used in place of the operation code part of the instruction eg SUB for substract . Symbolic addresses which are used in place of actual machine addresses. Example MEM1 to represent first memory address. The symbolically written program has to be translated into machine language before being used operationally. 15

Example An assembly program to add numbers stored in ax and bx registers (memory) m ov ax,60 m ov bx,50 a dd ax,bx 16

It is easy to locate and identify syntax errors, thus it is easy to debug it. It is easier to develop a computer application using assembly language. 17 Advantages of Assembly language over machine language

Advantages of Low-level languages The CPU can easily understand machine language without translation. The program instructions can be executed by the hardware (processor) much faster. This is because; complex instructions are already broken down into smaller simpler ones. Low-level languages have a closer control over the hardware, are highly efficient & allow direct control of each operation. They are therefore suitable for writing Operating system software & Game programs, which require fast & efficient use of the CPU time. They require less memory space. Low-level languages are stable, i.e., they do not crash once written. 18

Disadvantages of Low-level languages They are difficult to learn, understand, and write programs in them. Their programs are difficult to debug (remove errors from). The programs are very long; hence, writing a program in a low-level language is usually tedious & time consuming . The programs are difficult to develop, maintain, and are also prone to errors (i.e., it requires highly trained experts to develop and maintain the programs). They are machine-dependent (specific), hence non-portable. This implies that, they are designed for a specific machine & specific processor, and therefore, cannot be transferred between machines with different hardware or software specifications. It is not easy to revise the program, because this will mean re-writing the program again. 19
Tags