COMP 202 Foundations of Programming

Instructor: Juan Camilo Gamboa Higuera

Use the arrow keys to navigate. Press 'm' to see all the slides.

Announcements

  1. The first assignment is out

    Due on September 19th

  2. Computer Science Undergraduate Society Help Desk

    Trottier 3rd floor.

    Monday & Tuesday & Wednesday & Thursday from 1:00pm - 5:00pm

    Starts on September 15th.

  3. COMP 202 course requirement

    If you're in CS and you know programming, you can skip this and take COMP 250

    If you're not in CS, talk to your academic advisor

This week

  1. Preliminary remarks

    Motivations

    Expectations

    Course Administration

  2. Basic concepts

    Algorithms

    Binary

    ASCII

  3. Basic tools for this course

    Scratch

    Java

    Eclipse

In the last class...

How is information represented on a computer?

Bit: 0 or 1

Counting with bits:

0 decimal = 0 binary
1 decimal = 1 binary
2 decimal = 10 binary
3 decimal = 11 binary
10 decimal = 1010 binary

What is 10101101?

What is 10101101?

128*1 + 64*0 + 32*1 + 16*0 + 8*1 + 4*1 + 2*0 + 1*1

173

How is information represented on a computer?

Encoding text with binary

ASCII: American Standard Code for Information Interchange

Other encodings: UTF-8 (Unicode), ISO-8859-1

What is an algorithm?

A sequence of instructions that transforms some initial conditions into some desired final conditions

e.g.

A sequence of instructions that transforms data

Two numbers into the result of an arithmetic operation

A yes/no question into an answer: yes or no (Decision)

A question about a set of numbers into a number that answers that question (Search)

The example from last's class video

Count the number of people in a room

N is a variable
A loop repeats operations
A conditional statement only gets executed when the condition holds

Today's example

Find the maximum number in a given list of numbers

Let MAX be equal to the first element in L
For each number n in the list L
| If n > MAX
| | Set MAX equal to n
Return MAX as the output

What is a programming language?

A way of translating algorithms into instructions executable by a computer


Ugly syntax that is ultimately transformed into a machine code (i.e. binary), which is executable by a computer

A more gentle introduction

Scratch! (clicky)

A sneak peek into Java

Code! (clicky)

Resources

/