Introduction to Programming

Introduction

Comparison to Spoken Languages

  • A form of communication.
  • What you intend to say vs. what the computer interprets.
    • Systems are literal. They do not know what you mean.

How Systems are Different from People

How systems think

Systems can only do three things:

  1. Remember something you told it to remember.
  2. Math.
  3. Communicate that it doesn’t know how to behave in a specific situation.

Things systems can’t do:

  1. Guess. Systems never guess. They behave according to specific sets of rules. If it seems like a system is guessing, it’s likely because you don’t understand the rules it’s following.
  2. Ask for help. Systems don’t know you’re there. Systems can prompt for input, provided they are instructed to do so. But they can’t ask for help.

Remembering

Doing Math

####

How people communicate

Body language, tone, inflection, context, etc.

People will often not tell you when they don’t understand. This may seem to be more or less true in certain contexts. But when people have an incentive to get along with you, they may not tell you when they don’t understand.

For example,

  • If you are a boss, people may not tell you when they don’t understand something because they have an incentive to seem competent.
  • If you are a teacher, students may not tell you when they don’t understand something because they have an incentive to seem smart.
  • If you are a parent, your children may not tell you when they don’t understand something because they have an incentive to seem obedient.

How systems communicate

Literal. No body language.

The rough equivalent of “context” in programming is scope.

var x = 5; // Set a variable named 'x' to 5

function foo() {
  var x = 10; // This redefines what x refers to within the scope of this function
  
  // At this point x does not refer to the var named x that we defined outside of this function
  
  console.log(x);
}

foo(); // prints 10

// Outside the scope of the function, x still refers to the var named x that we defined outside of the function
console.log(x); // prints 5

System Whispering

Learning the Syntax

Learning the Libraries & Frameworks