Course Intro - Intro to Computer Science
Intro to Computer Science
- Introductions
- What you know you knew
- What you didn’t know you knew
- What you knew you didn’t know
- What you didn’t know you didn’t know
- How this course works
- What to do now
- 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
- discord: @foo.barstein
You
- Probably an aspiring programmer.
- Perhaps an aspiring computer scientist.
- Hopefully interested in making things and solving problems.
- Willing to spend hours by yourself reading and staring at code.
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.
- integers
- floating point numbers
- booleans
- strings
- lists
- dictionaries/hash tables/associative arrays
- nonetypes/null/nil
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.
- Object-oriented programming
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?
-
What is a file? What is a folder?
-
What are good names for files and folders?
-
How do you use the command line?
-
What is a compiler? What is an interpreter? An assembler?
-
What is an operating system? What is an application?
-
What is the Internet? What is The World Wide Web?
-
What is The Cloud?
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
- 25% quizzes
- 35% assignments
- 10% first exam
- 15% second exam
- 15% third exam
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.
Complete the consent form
Your consent is necessary since we use software that is not obliged to abide by the Family Educational Rights and Privacy Act.
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.
- Git for Windows additionally comes with Git Bash, which gives Windows users a UNIX-like command shell.
- WINDOWS USERS - you should use Git Bash or Windows Subsystem for Linux (WSL) rather than Windows’ default Powershell or other command line shell program. To set Git Bash or WSL as the default terminal shell within Visual Studio Code, you can try to follow the instructions in the second answer here by Mahade Walid and edited by FruityOatyBar (ignore the first answer, which is outdated).
- Mac users already have a UNIX command shell in the Terminal app.
Conclusions
-
Welcome!
-
Start to think like a compiler… or is it an interpreter… or an assembler?
print("There's no reason to worry... {}".format("yet!"))
- Thanks. Bye.