knowledge-kitchen

Course Intro - Intro to Computer Science

Intro to Computer Science

  1. Introductions
  2. What you know you knew
  3. What you didn’t know you knew
  4. What you knew you didn’t know
  5. What you didn’t know you didn’t know
  6. How this course works
  7. What to do now
  8. Conclusions

Introductions

This course

Introduction to Computer Science

Official description:

How to design algorithms to solve problems and how to translate these algorithms into working computer programs. Experience is acquired through projects in a high-level programming language. Intended primarily for computer science majors but also suitable for students of other scientific disciplines. Programming assignments.

Me

Foo Barstein

You

Computer science

The study of the theory and practice of computation. Very open-ended.

not programming == computer_sciencing
computer_sciencing.find(computers) == -1
computer_sciencing not in sciences

What you know you knew

Data types

Programs usually think of data in terms of rigid stereotypes.

Review data types.

Input and output

There are many ways to input and output data from / to external sources.

response = input("What's brown and sticky?")
print("'{}' is correct!".format(response.capitalize()))

Review input and output.

Boolean logic and decision-making

Programs can adapt to context.

if this or that and the_other is not also_that:
    thats_wonderful()

Review boolean logic and decision-making.

Functions

Functions are modular blocks of code usually designed to perform a single task.

def thats_wonderful():
    print("That's wonderful")

Review functions.

Modules

A module is a simply a reusable library of code.

# import random module
import random

def thats_wonderful():
    # use a function from the random module
    if random.randint(1,10) > 5:
        print("That's wonderful")
    else:
        print("Okay...")

Review modules.

For loop and while loops

You have choices when repeating blocks of code.

for i in range(10):
    print("Welcome!")
i = 0
while i < 10:
    print("Welcome!")
    i = i + 1

Review for loops and while loops.

Lists

Lists are useful for storing a set of related values.

favorite_foods = [
    "Pizza with glyphosate-coated bleached wheat flour and soy cheese",
    "Coffee with GMO corn syrup solids added",
    "Emulsified non-fat sugar-free ice cream with artificial sweetener"
    ]

Review lists and more lists.

Dictionaries

Dictionaries contain key/value pairs.

phone_numbers: {
    "Foo Barstein": "646-888-5623",
    "Baz Foo":      "212-717-3297",
    "Bar Baz":      "747-211-8451"
}

Review dictionaries and more dictionaries.

Text files

Data can be stored and retrieved from text files.

# open file in read mode
f = open('data.csv', 'r')
# print out each line of the file
for line in f:
    data = line.split(",")

Review text files.

Strings

Languages offer many ways to analyze and manipulate text data.

text = "This,That,The other"
text = text.lower()
pos = text.find(",")
if pos > 0:
    data = text.split(",")

Review strings and string formatting.

What you didn’t know you knew

Variables, literals, expressions, and function calls

There are many ways to express value in programs.

"I am literally a literal"
I_am_not
math.pow(washington, 2) + park

Review variables, literals, and expressions.

Dot notation

Dots indicate belongingness.

random.randint(5, 10)
math.pow(2, 2)
'help me'.islower()

Other languages

Try to convince me that you don’t understand this code:

let x = 5;
let y = true;
if (x < 10 and y == true) {
    console.log("Easy peasy!");
}
int x = 5;
boolean y = true;
if (x < 10 and y == true) {
    System.out.println("Easy peasy!");
}

What you knew you didn’t know

A popular way to think about programs with interacting parts.

you = new Student("Jane Doe")
me = new Professor("Foo Barstein")
me.say_hello(you)

Jump ahead half a semester to object-oriented programming

What you didn’t know you didn’t know

Basic computer concepts and terminology

Can you answer these questions?

Review basic computer concepts.

Alias vs. copy

What is printed?

x = 5
y = x
x = 10
print(y)

Try it out yourself.

Raw strings

How many lines are printed?

x = "First line\nSecond line"
print(x)
x = r"First line\nSecond line"
print(x)

Learn about raw strings.

Multidimensional arrays

row1 = [1, 2, 3]
row2 = [4, 5, 6]
row3 = [7, 8, 9]
data = [row1, row2, row3]
print(data[1][2])

Jump ahead half a semester to multi-dimensional arrays.

Recursion

How many times is the function called?

def foo(x):
  if x < 3:
      foo(x+1)
      foo(x+1)

foo(1)

Jump ahead almost a semester to recursion.

You can place out of this class

If you are comfortable with multi-dimensional arrays, object-oriented programming, and recursion, consider taking a placement exam to skip this course.

Learn about placement exams.

How this course works

Lecture

I will speak for 75 minutes about twice each week…. that’s 150 minutes of talking each week.

I sincerely hope for your sake and mine that you will interrupt me and ask lots of questions.

Notes

I write notes for most lecture topics. You may find them useful but incomplete.

Slides

Students constantly request slides, so I have made them. However, I believe you are better off reviewing documents and code. Each slide has a link to its “source” document, which may be easier to read.

Reading

Reading assignments from the textbook and elsewhere each class. The textbook is quite thorough.

Assignments

You will have somewhere around 10 assignments.

You lose 10 points for each day late and we do not accept submissions more than 3 days late.

See the complete lateness policy.

Extensions

Please do not ask for an extension.

You are hereby granted 2 free extensions for work submitted up to 3 days past the due date.

Quizzes

Regular simple multiple-choice online quizzes. These are meant to help you self-assess your own mastery of conceptual material.

Exams

You will take 3 exams.

Many find the first exam to be easy. The second and third… not so much!

Students who come to class tend to do better.

Grading

Communication

We use Dicord for all communication outside of the classroom.

You must create a private channel in Discord.

Check the complete Discord details.

Tutoring

Tutors are waiting to answer your questions virtually all day every day of the week.

See them often. See them fast.

Check the complete tutoring schedule.

What to do now

Review the syllabus

The syllabus contains basic information on how this course works.

Bookmark the schedule

The schedule contains a day-by-day breakdown of everything you need to know and do in this course.

Your consent is necessary since we use software that is not obliged to abide by the Family Educational Rights and Privacy Act.

Complete the form

Contact me if you have concerns about privacy.

Download and JDK version 8

The Java Development Kit (JDK) is a necessary set of tools that help develop Java programs. Install the Standard Edition (SE). We use the older version 8 because it is compatible with Processing, which we will use later in this course, whereas Processing is not compatible with newer versions of the JDK.

https://www.oracle.com/java/technologies/downloads/#java8

Download and install Visual Studio Code

Visual Studio Code is an Integrated Development Environment (IDE) that integrates with the JDK to allow you to easily write and debug Java programs.

https://code.visualstudio.com

Download and install the Extension Pack for Java

These extensions to Visual Studio Code make it suitable for Java programming.

https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack

Install Git

Get git for Mac or Git for Windows.

Conclusions

print("There's no reason to worry... {}".format("yet!"))