140 likes | 159 Views
INTRODUCTION TO COMPUTER PROGRAMMING ITC-314. LECTURE 03. Computer Programming. Computer Programming means creating a sequence of instructions to enable a computer to do something. OR
E N D
INTRODUCTION TO COMPUTER PROGRAMMING ITC-314 LECTURE 03
Computer Programming • Computer Programming means creating a sequence of instructions to enable a computer to do something. OR Computer programming (often shortened to programming or coding) is the process of writing, testing, debugging/troubleshooting, and maintaining the source code of computer programs.
Program, Programmer, & Programming • The set of instructions given to the computer is called a program. • The person who writes a computer program is called programmer . • The job or process of writing a program is called Programming.
The Need of Programming • Computer is provided with a set of instructions and some relevant data. These instructions are stored in the memory of computer. Computer picks instructions from the set one by one and performs operations on the given data accordingly. Taking an example of addition of two numbers the following set of instructions will given to the computer. • Input or Read first number and call it A • Input or Read second number and call it B • Add A and B and put result in C • Display the value of C to the user. This set of instructions is to be stored in the computer main memory. This phase is called loading. Once loaded, the computer will start action on these instructions one by one. This phase is called execution.
In the pervious example the computer will ask and take the value of first number from the user through an input device like keyboard. The computer will put this value in memory. The process of taking values from input device is called reading. • In the second instruction the computer will read the value of B. in the next instruction the computer will perform the arithmetic operation of addition on the values A & B and remember the result by the name C. in the last instruction the computer will display the value of C on an output device like monitor. • Unfortunately, programming a computer is not that simple as given in above example. It is mainly because of two reasons. Firstly, writing a problem in steps is not always so simple and secondly, computer cannot understand English language. Therefore we must learn a programming language to create programs for instructing the computer.
Programming Language • The language in which a computer programs are written is called programming Language. OR • A Programming Language is a vocabulary and set of grammatical rules for instructing a computer to perform specific tasks.
Programming Language Cont…. • A programming language or computer language is a means of communication between the user and computer. As we use a natural language, such as English to communicate our ideas and emotions to others. Similarly, a computer language is used by programmer to instruct a computer what he/she wants it to do. • All natural languages (English, French, Urdu etc) use a standard set of words and symbols for the purpose of communication. These set of words and symbols in a language is called Vocabulary of the language. In a similar manner, all computer languages have a vocabulary of their own. • The main difference b/w a natural language and a computer language is that the natural languages have a large vocabulary, but the most computer languages use a very limited or restricted vocabulary.
Categories of Programming Language • As we say that every programming language has its own set of rules which are used for different operations. • Following are the different categories of programming languages. • Machine Language • Low Level Language (LLL) • High Level Language (HLL)
Machine Language • The easily understandable language for computer is known as Machine language. • Because Computer can understand and perform operations only on binary numbers. A machine language consists of strings of binary numbers and is the only language that the computer understands directly without any translations. It is a combination of Os and Is. Machine language is easy for computers and is difficult for programmers.
Low-Level Languages • A Language which is one step higher than the machine language in human readability is called assembly language or a low-level language. • A machine language consists totally of numbers and is almost impossible for humans to read. • In assembly language some of these numbers are replaced by human readable symbols called mnemonics. • An assembly language is a combination of mnemonics operation codes and symbolic codes for addresses. Each computer uses and has a mnemonic code for each instruction
Assembler • A program written in an assembly language is translated into a machine language before can computer can understand and execute it. A computer program which translates an assembly language program into its equivalent machine language is known as an assembler.
High-Level Languages • A Language one step higher than low-level languages is called High-Level language. • High- level languages are developed to enable the users to program computers easily. These languages are easy to understand. • They are also called as English oriented languages in which instructions are given using words, such as add, subtract, input, print, etc. • High level languages are easy for human to understand but it is difficult for computers, so compiler program is used to translate HLL program into Machine language
Basic • Beginners All-Purposes Symbolic Instructions code, abbreviated as BASIC, was developed at the Dartmouth College, USA, by John Kemeny and Professor Kurtz. • BASIC languages were initially developed to make it convenient for the people to communicate with computers. • BASIC has improved over the years , but unfortunately it is not a portable language i.e., a program developed in basic on one computer may not run on another without necessary modifications. This is because different versions of BASIC do not conform to the same standards.