Review: how information is stored/represented in computer programs

  • Computer programs store information in their variables

  • Principle of information representation:

    • Information = code + context

  • Information in a computer program are stored in:

    • Program variables

  • Applying the principle of information representation to computer programs:

    • The value (always stored as a binary nunber) of a variable is the code

    • The data type of the variable is the context used to interpret the value (= code)


  • In this webpage, I will give an overview of the codes used inside the computer
  • We will discuss the various codes used later

Overview of the information categories/data types used in a computer system

  • Computer programs must deal with the following categories of information:

  • The Java programming language provides the following primitive/"built-in" data types to represent the different categories of information:

    • Boolean information: uses the data type boolean
    • Signed integer (whole values): uses data types byte, short, int and long
    • Floating point values: uses data types float and double
    • Alpha-numerical data: uses data type char

    Note: Java does not support the unsigned integer information.

Overview of the codes used in each data type

  • Data types are designed to represent some category of information effectively and efficiently

  • Therefore:

    • Each data type has its own information encoding method/technique

      (Some od the encoding method/techniques are based on Math !!!)


  • Today's computers (always) use the following encoding methods for the corresponding data type:

Computer codes and encoding/decoding methods

  • Computer code:

    • Computer code = a binary number

      The binary number is always used to represent some type of information

  • Encoding/decoding method:

    • Encoding/decoding method = the procedure that is used to construct/interpret a computer code (= binary number)

  • There are 2 types of codes:

    1. "Committee based" code:   developed by an agreement

    2. Mathematical code:   the codes are constructed using Math operations

Preview on the discussion on data types
 

  • We will first study the different encoding methods used in computer (so to understand their strength and short comings !!!)

      • We will start with representing Boolean values      

  • We will also discuss how to convert between different codes (= representations)

    (I.e.: converting one data type to another of the data type.)

      • The conversion is especially important when we discuss input/output to/from a computer program