PROGRAMMING

1. The Computing Model

Programming acts as the bridge between a human-defined task and the physical electronic devices that execute it. The layers of this model include:

  • Task & Algorithm: The conceptual problem and the step-by-step solution.

  • Program: The algorithm expressed in a specific programming language.

  • Instruction Set Architecture (ISA): The boundary between software and hardware.

  • Microarchitecture, Logic Gates, & Devices: The physical implementation that executes the instructions.


2. Low-Level Languages

Machine Language
  • Definition: A language consisting of binary-coded instructions built into a computer's hardware and used directly by the CPU.

  • Characteristics: Every processor type has its own specific Instruction Set, and instructions typically perform only one very basic task.

Assembly Language
  • Definition: A low-level language that replaces binary opcodes with mnemonics (e.g., ADD, MOV) and replaces binary addresses with names.

  • Assembler: A program that translates assembly language code into machine code.


3. High-Level Languages & Translation

High-level languages allow programmers to write code that is more "human-readable" and independent of specific hardware.

  • Compiler: A program that translates a high-level language (like C++ or Java) into machine code or an intermediate code all at once before execution.

  • The Process:

    1. Source Code: The high-level instructions written by the programmer.

    2. Translation: The compiler checks for syntax errors and converts the code.

    3. Object Code: The machine language version produced by the compiler.


4. Expressing Logic: Pseudocode

Pseudocode is a way to express algorithms using a mixture of English and programming logic without worrying about strict syntax.

Core Constructs:
  • Variables: Used to store data (e.g., Set count to 1).

  • Selection (Control Flow): Choosing between different paths of execution using IF, ELSE IF, and ELSE statements.

  • Repetition (Looping): Repeating a series of statements as long as a condition is met (e.g., WHILE loops).


5. Software Testing

To ensure a program works correctly, developers use a Test Plan, which specifies how many times and with what data the program must be run.

Testing Approaches:
  • Code Coverage (White Box/Clear Box): Designing test cases by looking at the internal logic and structure of the code itself.

  • Data Coverage (Black Box): Designing test cases based on the range of allowable input and output data values, without looking at the internal code.

  • Implementation: Using the test cases to verify that the program produces the expected results.