Requirement #3: Basic Concepts

Tip

Getting started!

Just like for any language, you need to learn some basic vocabulary before attempting to write sentences! This is the same for computer programming. Some teachers (including me) believe in pushing this metaphor further by adopting the following procedure: (1) Learn some basic vocabulary so you can start understanding some simple commands (2) Learn by mimicking (that is: study a simple piece of existing code and modify it) (3) Learn more commands and start writing your own codes

When I teach computational sciences, I often tell my students: a good programmer is not a person who writes good codes! Rather, it is a person who can edit their codes to make them work! So, be patient and do not depair if things don’t work out the way they are supposed to at first!

\(\boxed{\mathbb{REQ}\Large \rightsquigarrow}\) Explore different concepts in computer programming. Discuss these programming concepts with your counselor:

  1. What is the difference between a local and global variable?

  2. What are integer, Boolean, floating point, and character data types and what values can each of these data types hold?

  3. What is a scalar variable versus an array or list variable?

  4. What are these types of control flow instructions, and how do they work?

    1. A While Loop

    2. A Do-While Loop

    3. For loop which performs a fixed number of iterations (i.e. For Loop)

    4. An If statement

  5. What is a function and when is it used?

  6. What is a parameter to a function?

  7. What is a key/value pair in a database?

  8. What is a Universal Resource Locator (URL) and where is it used??

Tip

A basic lexicon (adapted from resources from usscouts.org)

  1. Types of variables

    1. A local variable is only defined and used within one routine. A global variable is defined for the entire program

    2. Integer — a variable that holds only whole numbers (e.g. 56, 7, -4, 23)

    3. Boolean — a variable that can hold only TRUE or FALSE

    4. Floating Point — a variable that can hold any real number (e.g. 71.045)

    5. Character variable — a variable that can hold only an alphanumeric character (e.g. “A”, “G”, “&”)

    6. A Scalar variable can only hold one value. An array or list variable can hold multiple values and each value can be selected using an index. (e.g. 5, 4, 10, -3 can be held in an integer array of size 4 called X. X[3] can refer to the 3rd element of the array)

  2. Basic construct

    1. A while loop continuously executes the code held in the loop while a condition that is checked at the beginning of the loop is TRUE and it exits the loop when the condition checked at the beginning of the loop becomes FALSE

    2. A Repeat loop continuously executes the code held in the loop while a condition checked at the end of the loop is TRUE and it exits the loop when the condition checked at the end of the loop becomes FALSE.

    3. A For Loop executes the code held in the loop a fixed number of times.

    4. An If statement executes a given computer instruction or a block of instructions if a condition is TRUE. It can also execute a different instruction or block of instructions if the condition is FALSE.

    5. A function is a block of instructions which computes a result and returns the result to the calling program. A program can branch to (or call) the function and then return back to where the function was called when the function completes. A function typically computes equations needed in multiple places in the program. (e.g. a function to calculate a polynomial given an input X value.)

  3. Other concepts

    1. A parameter is an input to a function used in the computation of the result.

    2. A Key/Value pair in database programming is a set of two linked data elements which allow the programmer to use a first key data element to find a result value based on the key (e.g. FirstName -> Joan, Lastname -> Smith)

    3. A Universal Resource Locator (URL) is a set of characters which identify a resource such as a webpage or a file on the internet so a program or user may access the webpage or file.

alternate text

Programming Coding Key Vocabulary Literacy and Definitions Poster. This image obtained from the https://images.app.goo.gl/cxsi1Ne6SJE5iWgm6.

Attention

Once you have completed this requirement, make sure you document it in your worksheet!