View
215
Download
0
Embed Size (px)
Citation preview
1
Foundations of Software Design
Lecture 1: Course OverviewIntro to Binary and Boolean
Marti HearstSIMS, University of California at Berkeley
2
Course Objectives
• Learn key computer science concepts.• Catch up on missing math background.• Become able to work on larger
programming projects.• Prepare you for IS206 in Spring.
3
Course Structure• Lectures
– Do readings in advance– Discussion encouraged
• Labs– Lead by the TAs– Practice concepts from lecture– Answer questions
• Homework– Something due almost every week– Often will be doing pair programming
• Grading– Not assigning letter grade, but giving feedback– To pass the class, you must attend all lectures and labs, and turn in all
homeworks on time• Exams
– I reserve the right to have exams if people don’t work hard
4
Instructors
• Professor: Marti Hearst• TAs
– John Fritch– Kaichi Sung– Leah Zagreus
• Office hours: TBA• Lab:
– Wed 12:30-2:00
5
TextBooks
Programming for Corpus Linguistics--How to do Text
Analysis in Java By Oliver Mason
Computer Science: An Overview, 7th EditionGlenn Brookshear
Data Structures & Other Objects Using Javaby Michael Main
REQUIRED
REQUIRED
STRONGLY RECOMMENDED
6
Course Outline
1. How Computers Work2. Object-Oriented Design3. Analysis of Algorithms4. Data Structures
1. Collections, Stacks and Queues2. Trees and Graphs3. Hash Tables4. Disk-based data structures
5. Search Algorithms6. Sorting Algorithms7. Formal Languages8. Computability
7
Useful Topics we are NOT covering:
(These should be covered in IS206)– Distributed systems
• Threads• Client-server architectures• Networking
– Security• Probability Theory• Coding theory (Huffman codes, etc))• Encryption
– Scripting
8
Lab Tomorrow
• Either take the placement exam in room 202• Or build a home page in the lab in room 210
9
Upcoming Reading Assignments
• For hyperlinks, see course website• For Today:
– Brookshear, Ch. 1.1-1.6
• For Thursday:– Brookshear 2.4, Online demo of logic gates and circuits
• For Tuesday Sept 3– Brookshear 2.1-2.5, Online demo of a CPU
• For Thursday Sept 5– Brookshear 3.1-3.5, 8.1-8.2
10
How Do Computers Work?
11
What happens when …
• Your program creates a variable?• You program runs a loop?• What really happens?
12
Binary Digits (Bits)
• Yes or No• On or Off• One or Zero• 10010010
13
Bytes
• A sequence of bits • 8 bits = 1 byte• 2 bytes = 1 word (sometimes 4 or 8 bytes)• How do binary numbers work?
14
Number Systems
For more info on number systems, seehttp://courses.cs.vt.edu/~csonline/NumberSystems/Lessons/index.html
Images from http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Circuits/index.html
15
Powers of Two
Decimal Binary Power of 2
1 1
2 10
4 100
8 1000
16 10000
32 100000
64 1000000
128 10000000
021222
42
32
526272
16
Famous Powers of Two
Images from http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Circuits/index.html
17
Orders of Magnitude
• Each increase in the power of 10 is an increase in order of magnitude
• http://micro.magnet.fsu.edu/primer/java/scienceopticsu/powersof10/index.html
18
Other Number Systems
Images from http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Circuits/index.html
19
Binary Addition
Images from http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Circuits/index.html
Also: 1 + 1 + 1 = 1 with a carry of 1
20
Boolean Logic • AND, OR, NOT, NOR, NAND, XOR• Each operator has a set of rules for combining two
binary inputs– These rules are defined in a Truth Table – (This term is from the field of Logic)
• Each implemented in an electronic device called a gate– Gates operate on inputs of 0’s and 1’s– These are more basic than operations like addition– Gates are used to build up circuits that
• Compute addition, subtraction, etc• Store values to be used later• Translate values from one format to another
21
Truth Tables
Images from http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Circuits/index.html
22
Interactive demo of Boolean logic
http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Gates/index.html