22
1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

1

Foundations of Software Design

Lecture 1: Course OverviewIntro to Binary and Boolean 

Marti HearstSIMS, University of California at Berkeley

 

Page 2: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, 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.

Page 3: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 4: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

4

Instructors

• Professor: Marti Hearst• TAs

– John Fritch– Kaichi Sung– Leah Zagreus

• Office hours: TBA• Lab:

– Wed 12:30-2:00

Page 5: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 6: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 7: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 8: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

8

Lab Tomorrow

• Either take the placement exam in room 202• Or build a home page in the lab in room 210

Page 9: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 10: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

10

How Do Computers Work?

Page 11: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

11

What happens when …

• Your program creates a variable?• You program runs a loop?• What really happens?

Page 12: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

12

Binary Digits (Bits)

• Yes or No• On or Off• One or Zero• 10010010

Page 13: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

13

Bytes

• A sequence of bits • 8 bits = 1 byte• 2 bytes = 1 word (sometimes 4 or 8 bytes)• How do binary numbers work?

Page 14: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 15: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 16: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

16

Famous Powers of Two

Images from http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Circuits/index.html

Page 17: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 18: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

18

Other Number Systems

Images from http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Circuits/index.html

Page 19: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 20: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

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

Page 21: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

21

Truth Tables

Images from http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Circuits/index.html

Page 22: 1 Foundations of Software Design Lecture 1: Course Overview Intro to Binary and Boolean Marti Hearst SIMS, University of California at Berkeley

22

Interactive demo of Boolean logic

http://courses.cs.vt.edu/~csonline/MachineArchitecture/Lessons/Gates/index.html