CIS 150 Programming Basics

Objectives

  • Discuss basic computer concepts
  • Define the four primary functions of a computer
  • Discuss function of major components of a computer system
  • Discuss and explain programming language levels
  • Discuss and explain general programming concepts

Primary functions of a computer

  • Input
  • Output
  • Processing
  • Storage

Computer components

  • Hardware (equipment)
    • input devices
    • output devices
    • processing devices
    • storage devices
      • primary storage: expensive, fast, relatively small amount, usually volatile
      • secondary storage: cheap, slow, usually a lot available, usually non-volatile
  • Software (programs)
    • operating systems
    • applications

Programming language levels

  • machine language (adding 2 numbers)
    100: a1 22 01 03 06 26 01 a3 22 01 a1 20 01 13 06 24 01 a3 20 01
    120: 11 22 33 44 55 66 77 88
  • assembly language
    100:
        MOV     AX,[0122]
        ADD     AX,[0126]
        MOV     [0122],AX
        MOV     AX,[0120]
        ADC     AX,[0124]
        MOV     [0120],AX
    120:
        DB      11 22 33 44 55 66 77 88
  • high-level language
    num1 = num1 + num2

In summary:

  • machine language: just numbers; what computer uses for instructions
  • assembly language: close to machine language, but uses mnemonics for easier human use
  • high-level language: a little closer to human language

Other programming concepts

  • everything in computer stored as numbers
  • computer runs on machine code
  • source code: the program as written by the programmer
  • compiler: turns source code into object code (close to machine code)
  • interpreter: executes source code by turning it into machine code line-by-line as it reads it
  • virtual machine: a program that runs inside one computer which emulates another computer
  • object code: program in machine code, not quite ready to run
  • executable: program in machine code ready to run
  • binary: base 2 number system; also used to describe executables
  • syntax: the rules of a language
  • logic: the instructions as opposed to the data
  • algorithm: a step-by-step process for solving a problem [know this definition]
  • structured: an approach to programming that restricts the logic of a program to specific control flow structures
  • object-oriented: an approach to programming that tends to model the world by creating modular programs containing both data and code in order to represent real-world objects

Programming process

  1. analysis: analyze the problem to be solved
  2. develop algorithm: figure out the the logic of the application
  3. code: turn the algorithm into actual source code using a programming language
  4. test/debug: make sure the program does what it is supposed to do
  5. documentation: ongoing from start of project; usually last thing to get finished