Introduction to computer programming


Published on

Brief intro on Computer Programming

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Introduction to computer programming

  1. 1. 1. Introduction to ProgrammingWhat is Computer Programming?Is the process of designing, writing, testing, debugging, and maintaining source code ofcomputer programs.(OR)Act of instructing computer to perform the task.Source codeIs any computer instruction (possibly with comments) written using some human readable computerlanguage (also known as, High-level Computer Language), usually as text.This source code is written in one or more programming languages (i.e. High-level language such as C,C++, C#, Java, Python, and Smalltalk).Programming LanguageRefer to the artificial language designed to communicate instruction to a machines particularly acomputer. Examples of Programming languages are C, C++, JAVA, Python, Machine Language andAssembly language.ProgramIs the sequence of instructions, written to perform a specific task with Computer.NOTE: The purpose of Computer Programming is to create a set of instructions (i.e. Program) thatcomputers use to perform specific operations or to exhibit desired behavior. Software refers to the collection/set of computer programs and related data to perform aspecified task with a computer.ProgrammerIs the someone who writes the computer program (Software) using any language of hisher choice.Classification of Computer Language: High-Level Language (Machine Independent Languages)Is the programming language with strong abstraction from the details of the computer. Theprogrammer can create the program using these languages without asking for design detailof the particular Machine which will run his/her program.Prepared By;NOEL MALLE, B.Eng (Computer Engineering)Kilimanjaro, Tanzania.
  2. 2. So, there is no need for a Programmer to study the design of the computer (such as,Processor Instruction Set Architecture, Bus types and width, Processor Registers types and size,and other Architecture Design).Hence, programmer focuses only on the Problem to be solved. This is the reason they are alsoknown as Problem-Oriented LanguagesFurthermore, programs created using these languages are Machine Independent, which means,they can run on Computer with different designs (e.g. Processor type) with little, or nomodifications required in their codes.Examples of High-Level Language: C C++ JAVA Low-Level Language (Machine Dependent Languages)Is the programming language that provides little or no abstraction from details of the computer.The programmer must have strong knowledge about Computer design in order to write theprogram for such Computer.Hence, there is need for a Programmer to study the design of the computer (such as,Processor Instruction Set Architecture, Bus types and width, Processor Registers types and size,and other Architecture Design).Furthermore, programs created using these languages are Machine Dependent, which means,the Program created for particular Machine can’t run on different Machine.Types of Low-Level Languages: Assembly Language Machine Language.NOTE:Other Programmers describe C-language as the Middle-Level Language because of the following2 reasons:A relatively good programming efficiency i.e. faster program development (as compared tolow level language)Relatively good machine efficiency i.e. faster program execution (as compared to high levellanguage)Hence, it occupies the space (level) between two, that is, middle level.Prepared By;NOEL MALLE, B.Eng (Computer Engineering)Kilimanjaro, Tanzania.
  3. 3. Language TranslatorsIs the computer program that translates a program written in a given programming language intofunctionally equivalent program in different language.There are various types of Language Translator but I will describe only two types of LanguageTranslators, which are: Compiler InterpreterCompilerTranslates a high level language (e.g. C, C++) into lower level language (i.e. Machine Language). Compilerchecks the entire user-written program (known as the source program) and, if error free, produces acomplete program in Machine Language. Each Language has its own Compiler.Examples of Compiled Languages:C, C++, COBOL, and Haskell.Examples of Compilers for various languages are as follow:C Pelles C, Power C, Turbo C.C++ C++ Builder, Borland C++, GCC, Turbo C++InterpreterTranslates a High level language into an Intermediate code which will be immediately executed. TheInterpreter translates one statement at a time and, if error-free, executes the instruction. EachLanguage has its own Interpreter.Examples of Interpreted Languages:BASIC, PHP, Perl, lisp, Smalltalk, and Ruby.Example of Interpreter is:BASIC Altair BASICDifference between Compiler and InterpreterCompiler InterpreterCompiler translates the whole program beforeexecution begins.Thus Interpreter translates and executes the firstinstruction before it goes to the second.Prepared By;NOEL MALLE, B.Eng (Computer Engineering)Kilimanjaro, Tanzania.Other types include; Assembler, DeCompiler,DisAssembler .
  4. 4. NOTE: JAVA is not listed as Compiled or Interpreted Language because; JAVA programs are Compiled(to bytecode) then Interpreted. Hence, it is both Compiled and Interpreted Language. Assembler is the computer program which translates Assembly Language to Machine Language. All Machines (Computer) understand Machine Code (Language) only. Hence, this leads to thenecessities of System Software such as Compiler, and Interpreter to convert High level languageto Machine code. Also, Assembler to convert Assembly Language to Machine Code.Generations of Computer Languages: 1stGeneration (Machine language) 2ndGeneration (Assembly Language) 3rdGeneration (Problem Oriented Languages such as C, Paschal, FORTRAN, and COBOL) 4thGeneration( e.g. dBASE, FoxPro, FOCUS)These are Low level LanguageHigh Level LanguagePrepared By;NOEL MALLE, B.Eng (Computer Engineering)Kilimanjaro, Tanzania.