Introduction to Computer Science I
WHY? Before the bicycle the cheetah was the most efficient animal on the planet. A computer is a bicycle for your mind.
This class teaches you to ride that bicycle
In order to utilize a computer we need to be able to express our ideas within it’s limits
First challenge. Learn a programming language that lets us do that.
Let’s build up some intuition What does a programing language really represent
Phone Book Search (Mike Smith) 0 pick up phone book 1 open to middle of phone book 2 look at names 3 if Smith is among names 4 call Mike 5 else if Smith is earlier in book 6 open to middle of left half of book 7 go back to step 2 8 else if "Smith" is later in book open to middle of right half of book go back to step 2 else quit
Shampoo Algorithm
Class Count 0 Stand up and think of the number 1 1 Pair off with someone standing. Add your numbers together. 2 One of you should sit down. If you're still standing, go back to step 1.
But HOW
Assembly/ Machine Language 1 1 0 0
Input 1 1 Output 1 A = 1 B = 1 A and B Compiler A = 1 Input 1 1 B = 1 A and B Output 1 High-level programming languages
Still no bicycle
What if we could build a machine that could add large numbers? Binary and XOR Gate
We need a way to represent numbers/info Binary We need a way to represent numbers/info
XOR GATE
Could we build a simple two bit adding machine
Compiler A = 0 B = 1 1 A + B Output 1 High-level programming languages
Memory and State Save multiple numbers so that we can compute
Memory Input 0 0 0 1 1 1 Memory Output 0 0 0 1 1 0
1 Output 1 A = 0 B = 1 C = A + B High-level programming languages Memory Input 0 0 0 1 1 1 Memory Output 0 0 0 1 1 0 Compiler A = 0 B = 1 1 C = A + B Output 1 High-level programming languages
MIT Video Programming Cells.
Code to DNA Quick Section of MIT Video MIT Video http://cidarlab.org/cello/
What language should we choose?
No perfect language “ There are only two kinds of programming languages: those people always [gripe] about and those nobody uses.” - Bjarne Stroustrup (Creator of C++)
/******************************************* * Prints "Hello, World" * Everyone's first Java program. *******************************************/ public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } We will talk about what the text in red means in later classes.
public class HelloWorld { public static void main(String[] args) { int a, b, c; a = 1; b = 0; c = a + b; System.out.println(c); }
Like learning to ride learning to program takes practice
https://www.youtube.com/watch?v=bvmibwafGXc
Test Quizzes Labs Logistics
Coursework and grading Labs. 20% Due on Fridays. Programming assignments. 25% Due on Tuesdays at 11pm via electronic submission. Late assignments will get docked 10% a day Exercises. 10% Due on Mondays at 11pm. Exams. 15% + 30% Midterm (in class on Wednesday, October 4). Final (to be scheduled by Registrar)
Textbook Introduction to Programming in Java [Amazon · Pearson · InformIT ] Robert Sedgewick and Kevin Wayne http://introcs.cs.princeton.edu/java/