01computer programming concepts

Upload: msaudrey-grace-taqueban-bathan

Post on 05-Apr-2018

232 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 01Computer Programming Concepts

    1/14

    COMPUTERPROGRAMMING

    CONCEPTS

    School of Engineering & Architecture

    COMP1 AL

    7/30/2010

    jnb

  • 8/2/2019 01Computer Programming Concepts

    2/14

    Computer science discipline dealing withthe creation and maintenance of computerprograms.

    One activity in the complex field of softwareengineering

    COMPUTER PROGRAMMING

  • 8/2/2019 01Computer Programming Concepts

    3/14

    SOFTWAREprograms or instructions thatmake the computer work.

    TYPES

    1. System Software

    2. Applications Software

  • 8/2/2019 01Computer Programming Concepts

    4/14

    PROGRAMMING LANGUAGEspecial-purpose language used to create and

    maintain programs

    specified by a well-defined set of rules syntax(grammar): specifies ways in which

    language elements can be combined to create validprograms

    semantics (meaning): specifies how a programbehaves

    programming language rules are more strictthan natural language rules

  • 8/2/2019 01Computer Programming Concepts

    5/14

    PROGRAMMING LANGUAGE(CATEGORIES)

    by level - how close the instructions are toML

    high-level language (HLL): human-like; usesEnglish-like terms; one HLL instruction = manyML instructions

    low-level language (LLL): machine-like; usesmnemonics or opcodes; almost one-to-oneinstruction correspondence between LLL and ML

  • 8/2/2019 01Computer Programming Concepts

    6/14

    MACHINE LANGUAGE (ML) native language of a computer

    ML is made up of very simple instructions. (addtwo numbers, jump to a program statement, fetchdata from memory, store data to memory, etc.)

    computers are powerful since they execute millionsof ML per second.

    ML is machine readable but is typically not readily

    understandable by humans.

  • 8/2/2019 01Computer Programming Concepts

    7/14

    MACHINE LANGUAGE (ML)-programming the computer by entering only the binary/

    hexadecimal operation codes.

    BINARY CODE HEX CODE COMMENTS

    00111110 00110010 3E 32 // LOADACCUMULATOR

    WITH 32H

    11010011 00000101 D3 05 // OUTPUTTHE CONTENTTO PORT 5

    01110110 76 // HALT

  • 8/2/2019 01Computer Programming Concepts

    8/14

    LOW LEVEL LANGUAGE

    Assembly Language- Mnemonics (abbreviations for the instruction operation

    codes-[opcodes]) are being entered in programming the

    computer.

    MNEMONICS COMMENTS

    MVI A, 32H LOAD ACCUMULATOR WITH 32H

    OUT 5 OUTPUT THE CONTENTS TO I/O

    PORT 5

    HLT HALT

  • 8/2/2019 01Computer Programming Concepts

    9/14

    HIGH LEVEL LANGUAGE

    Pascal Languagevar

    x, y, z : integer;

    begin

    x := 10;

    y := 3;

    if y 0 thenz := x div y;

    end.

  • 8/2/2019 01Computer Programming Concepts

    10/14

    HIGH LEVEL LANGUAGE

    BASIC Language10 INPUT N1,N2

    20 PRINTSUM = ; N1 + N2

    30 END

  • 8/2/2019 01Computer Programming Concepts

    11/14

    HIGH LEVEL LANGUAGE

    C Language

    # include

    # includemain(){

    printf(Hello World!);

    getch();}

  • 8/2/2019 01Computer Programming Concepts

    12/14

    HIGH LEVEL LANGUAGE

    Java Language

    public class gg {

    public static void main(String[] args) {

    System.out.println("Hello World!");

    }}

  • 8/2/2019 01Computer Programming Concepts

    13/14

    PROGRAM TRANSLATIONconversion of a program (called the source

    code) written in some programminglanguage to its equivalent program (calledexecutable, or object code) in the

    machine language of a target computerILLUSTRATION:

    ML

    1110111011

    PROGRAMTRANSLATION

    SOURCE

    CODE

    IN

  • 8/2/2019 01Computer Programming Concepts

    14/14

    PROGRAM TRANSLATION

    categories:

    compilers: translates an entire

    source code(high level languageprogram) to the equivalent object orexecutable code

    assemblers: translates assemblylanguage to ML