50
CMSC 100 CMSC 100 Course Overview Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1 CMSC 100 -- Overview

CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Embed Size (px)

Citation preview

Page 1: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

CMSC 100CMSC 100

Course OverviewCourse Overview

Professor Marie desJardinsThursday, August 30, 2012

Thurs 8/30/121CMSC 100 -- Overview

Page 2: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Thurs 8/30/12CMSC 100 -- Overview

2

wordle.net

Page 3: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

OverviewOverview

Who am I?

What is Computer Science?

Course Logistics

First Assignments

UPC/QR Code Example

Thurs 8/30/12CMSC 100 -- Overview

3

Page 4: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Who am I?Who am I?

Thurs 8/30/124CMSC 100 -- Overview

Page 5: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

About the InstructorAbout the Instructor Prof. Marie desJardins

A.B. Engineering, Harvard 1985

Ph.D. Computer Science, Berkeley 1992

Research Scientist, SRI, 1991-2001

Professor at UMBC 2001-now

Tenured in 2007; promoted to Professor in 2011

Married since 1985, two daughters (ages 16 (junior in high school) and 18 (sophomore in college))

Like to read, do crossword puzzles, sing, play the piano, cook, ski, travel, eat great food5

Class Intro 1/30/11

Page 6: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

My ResearchMy Research Artificial intelligence

How to get computers to behave in ways that we would consider to be “intelligent”

Machine learning: Making computers adaptable and able to improve their performance over time

Planning: Enabling computers to make decisions and solve problems

Multi-agent systems: Getting computers to interact effectively with each other and with humans

6

Class Intro 1/30/11

Page 7: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Research ProjectsResearch Projects Integrating low-level learning and planning to enable

“skill bootstrapping” (the ability to layer successively more complex skills on top of each other to solve hard problems)

Modeling trust in dynamic real-world environments like supply chain management

Analyzing planning problems to construct libraries of contingency plans for rapid replanning

Preference learning to discover users’ preferences in online rating systems and other applications

Learning from sparse data, and understanding uncertainty in learned models7

Class Intro 1/30/11

Page 8: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

What is Computer What is Computer Science?Science?

Thurs 8/30/128CMSC 100 -- Overview

Page 9: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

The Computer The Computer RevolutionRevolution

How fast did this happen? [ http://www.blinkenlights.com/pc.shtml ] 1950: “Simon” (plans published in Radio Electronics) 1973: HP 65 (programmable calculator) 1975: Altair 8800 (first widely used programmable computer

kit) 1977: Apple II (a huge breakthrough, the first mass-produced,

inexpensive personal computer) 1981: IBM 5150 PC (now we’re really taking off)

1984: Apple Macintosh 128K (my first computer!!)

2008: MacBook Air(my newest computer!)

Thurs 8/30/12CMSC 100 -- Overview

9

Page 10: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Moore’s LawMoore’s Law Computer memory

(and processing speed, resolution, and just about everything else) increases exponentially (roughly: doubles

every 18-24 months)

Thurs 8/30/12CMSC 100 -- Overview

10 Source: wikipedia

Page 11: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Measuring MemoryMeasuring Memory One 0/1 (“no/yes”) “bit” is the basic unit of memory

Eight (23) bits = one byte 1,024 (210) bytes = one kilobyte (1K)*

1,024K (220 bytes) = one megabyte (1M) 1,024K (230 bytes) = one gigabyte (1G) 1,024 (240 bytes) = one terabyte (1T) 1,024 (250 bytes) = one petabyte (1P) ... 280 bytes = one yottabyte (1Y?)

How many different patterns can you represent with one bit of storage? Two! (It’s either 0 or 1; that’s it, no in between)

How many different patterns can you represent with one byte of storage?

Thurs 8/30/12CMSC 100 -- Overview

11* Note that external storage is usually measured in decimal rather than binary (1000 bytes = 1K, and so on)

Page 12: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

What Was It Like What Was It Like Then?Then?

The PDP-11/70s I used in college had 64K of RAM, with hard disks that held less than 1M of external storage

... and we had to walk five miles, uphill, in the snow, every day! And we had to live in a cardboard box in the middle of the road!

Thurs 8/30/12CMSC 100 -- Overview

12

Page 13: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

What Is It Like Now?What Is It Like Now? The PDP-11/70s we used in college had 64K of RAM, with hard disks

that held less than 1M of memory

The cheapest Dell Inspiron laptop ($399.99) has 4G of RAM and a 50G hard drive.... [twice as much as the capacities I mentioned when I last taught this course, just three years ago...]

...a factor of 1018 more RAM and 1013 more disk space

...and your iPod nano has 8G (or 16G!) of blindingly fast storage

...so don’t come whining to me about how slow your computer is!

Thurs 8/30/12CMSC 100 -- Overview

13

Page 14: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

It’s Not Just Speed, It’s It’s Not Just Speed, It’s QuantityQuantity

So just how big a revolution are we talking about?

How many computers do you think were in the room when I took my first programming class? Answer: ZERO.

How many computers are in this room?

Thurs 8/30/12CMSC 100 -- Overview

14

Page 15: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Grand Challenges for CSGrand Challenges for CS

http://www.cs.cmu.edu/~claytronics/software/ thebrain.mcgill.ca

Smart Matter

Human-Level Intelligence

Information Search

Autonomous

Vehicles

Information Integration

Thurs 8/30/12

15

CMSC 100 -- Overview

Page 16: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

How Does a Computer How Does a Computer Work?Work?

“The work performed by the computer is specified by a program, which is written in a programming language. This language is converted to sequences of machine-language instructions by interpreters or compilers, via a predefined set of subroutines called the operating system. The instructions, which are stored in the memory of the computer, define the operations to be performed on data, which are also stored in the computer's memory. A finite-state machine fetches and executes these instructions. The instructions as well as the data are represented by patterns of bits. Both the finite-state machine and the memory are built of storage registers and Boolean logic blocks, and the latter are based on simple logical functions, such as And, Or, and Invert. These logical functions are implemented by switches, which are set up either in series or in parallel, and these switches control a physical substance, such as water or electricity, which is used to send one of two possible signals from one switch to another: 1 or 0. This is the hierarchy of abstraction that makes computers work.” -- W. Daniel Hillis, The Pattern on the Stone

Thurs 8/30/12CMSC 100 -- Overview

16

Page 17: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

How Does a Computer How Does a Computer Work?Work?

“The work performed by the computer is specified by a program, which is written in a programming language. This language is converted to sequences of machine-language instructions by interpreters or compilers, via a predefined set of subroutines called the operating system. The instructions, which are stored in the memory of the computer, define the operations to be performed on data, which are also stored in the computer's memory. A finite-state machine fetches and executes these instructions. The instructions as well as the data are represented by patterns of bits. Both the finite-state machine and the memory are built of storage registers and Boolean logic blocks, and the latter are based on simple logical functions, such as And, Or, and Invert. These logical functions are implemented by switches, which are set up either in series or in parallel, and these switches control a physical substance, such as water or electricity, which is used to send one of two possible signals from one switch to another: 1 or 0. This is the hierarchy of abstraction that makes computers work.” -- W. Daniel Hillis, The Pattern on the Stone

Thurs 8/30/12CMSC 100 -- Overview

17

Page 18: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Abstraction: The Key Abstraction: The Key Idea!Idea!

Computers are very complex

Most interesting programs are very complex

What makes it possible to design and maintain these complex systems??

Which just means: Once we’ve solved a “low-level detail,” we can treat that

solution as a “black box” with known inputs and outputs, and not worry about how it works.

The way we get there is called problem reduction (or decomposition or divide-and-conquer)

Thurs 8/30/12CMSC 100 -- Overview

18

Page 19: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Course Overview and Course Overview and PoliciesPolicies

Thurs 8/30/1219CMSC 100 -- Overview

Page 20: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

What This Class is What This Class is AboutAbout

How computers are built, programmed, and used to solve problems Hardware: Digital logic and system architecture Systems: Operating systems and networks Software: Basic programming/algorithms, databases Theory: Algorithms, computation, complexity Applications: AI, graphics, … Social issues: Ethics, privacy, environmental impact

Other skills emphasized: Effective writing and presentation skills Basic programming (in Scratch) Foundational mathematics for computer science

Thurs 8/30/12CMSC 100 -- Overview

20

Page 21: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

What this class is What this class is NOT aboutNOT about

How to install Windows or Linux

How to use Excel and PowerPoint

What kind of computer you should buy

Advanced programming techniques

Thurs 8/30/12CMSC 100 -- Overview

21

Page 22: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Course LogisticsCourse Logistics Instructor: Prof. Marie desJardins, [email protected]

http://www.csee.umbc.edu/~mariedj/Office hours: Tues 2:30-3:30, Wed 2:00-3:00, ITE 337

TAs (ITE 349): Clay Alberty, [email protected]

Office hours: Mon 2:30-4:30pm Kellie LaFlamme, [email protected],

Office hours: Tues/Thurs 11:30-12:30pm Stephanie Schneider, [email protected]

Office hours: Wed 4-5pm Course website/syllabus:

http://www.csee.umbc.edu/courses/undergraduate/100/Fall12/

Schedule: http://www.csee.umbc.edu/courses/undergraduate/100/Fall12/schedule.html

Thurs 8/30/12CMSC 100 -- Overview

22

Page 23: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

TextbookTextbook Schneider and Gersting, Invitation to Computer Science, 6/e

About half of the reading in the book will be assigned, as will many chapter exercises

I’ve requested a reserve copy to be placed on reserve at the library

You can buy it on Amazon for $84.44 (lessthan the bookstore is charging...)

You can buy the ebook for $76.49 at the Cengage website

Buy an earlier edition at your own risk! It’s your responsibility to have access to the 6th edition content and exercises Does anybody already have the 5th edition?

Thurs 8/30/12CMSC 100 -- Overview

23

Page 24: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

My ExpectationsMy Expectations Students will…

Attend class regularly Be prompt, and not engage in distracting or disruptive behaviors

NO LAPTOPS OR CELLPHONES (INCLUDING TEXTING) DURING CLASS

(yeah, I know it seems weird in a CS class…) Know what work is due, and turn in assignments promptly Follow the course’s academic honesty policy Be engaged in the learning process, respectful of the course staff,

and supportive of your fellow students Express concerns and ask questions Understand that the course staff has other obligations outside of

this class

Thurs 8/30/12CMSC 100 -- Overview

24

Page 25: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Your ExpectationsYour Expectations The instructor will…

Tell students what is expected in terms of coursework and behavior

Be fair in giving assignments, grading assignments, and returning coursework in a timely fashion

Let students know how they are doing in the class Answer questions and concerns promptly Be open to feedback and suggestions Be respectful of students Try to make the course useful, interesting, and enjoyable Understand that students have other obligations outside of this

class

Thurs 8/30/12CMSC 100 -- Overview

25

Page 26: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Academic Honesty Academic Honesty PolicyPolicy

See handout…

Thurs 8/30/12CMSC 100 -- Overview

26

Page 27: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Course Course CommunicationsCommunications

Email Requests for extensions, questions about course policies Dr. dJ Grading inquiries, requests for help with assignments TA

Still having trouble? Talk to Dr. dJ

Office hours One point of EXTRA CREDIT if you come to my office hours

(or stop by any time my door is open) in the next two weeks (i.e., by Thursday 9/13) to introduce yourself and chat for a few minutes!

Piazza Instructor postings and polls Discussion board

Blackboard Some assignment submissions

Thurs 8/30/12CMSC 100 -- Overview

27

Page 28: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Homework Homework ExpectationsExpectations

Homework expectations: In general, there will be an assignment (a homework or programming

assignment, or a research paper deliverable) due each Tuesday The primary purpose of the homework assignments is to keep you on

track with the reading, and to provide me with feedback about problem areas, well in advance of the midterm and final exams. (The exams will be very similar to the homework assignments and will also have some simple programming questions.)

Please plan your time (to do the reading and complete the assignments) accordingly!

All assignments are to be submitted in class (i.e., as hardcopy!) unless otherwise specified (and must be legible and stapled!)

Late policy (see course syllabus)

Thurs 8/30/12CMSC 100 -- Overview

28

Page 29: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

First AssignmentsFirst Assignments IMPORTANT: You need to have access to your own

computer in order to do the work in this class. Please see Dr. desJardins immediately about access to lab machines if you do not have your own computer.

Academic Honesty Policy and Survey: Due Tuesday 9/4

HW 1: Due Tuesday 9/11

PA 0: Due Thursday 9/13

Thurs 8/30/12CMSC 100 -- Overview

29

Page 30: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Example: UPC CodesExample: UPC Codes(ok, ok, so that’s kinda like saying “ATM machines...”)(ok, ok, so that’s kinda like saying “ATM machines...”)

Thurs 8/30/1230CMSC 100 -- Overview

Page 31: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Universal Product Universal Product CodesCodes

First scanned product: Wrigley’s gum (1974)

Method of identifying products at point of sale by 11-digit numbers

Method of encoding digit sequences so they can be read quickly and easily by a machine

Thurs 8/30/12CMSC 100 -- Overview

31

Slides for the UPC example courtesy of

Prof. Michael Littman (Brown University)

Page 32: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Reduction IdeaReduction Idea Each level uses an encoding to translate to the next level

(i.e., the next higher abstraction)• Patterns of ink.• Sequence of 95 zeros and ones (“bits”).• Sequence of 12 digits.• Sequence of 11 digits.• Name/type/manufacturer of product.

Thurs 8/30/12CMSC 100 -- Overview

32

Page 33: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Product NameProduct Name Ponds Dry Skin Cream

• 3.9 oz (110g)• Unilever Home and Personal Care USA

Name Badge Labels (Size 2 3/16" x 3 3/8")• 100 Labels• Avery Dennison/Avery Division

Thurs 8/30/12CMSC 100 -- Overview

33

Page 34: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

11-Digit Number11-Digit Number Digit = {0,1,2,3,4,5,6,7,8,9}

Sequence of 11 digits

QUESTION: How many different items can be encoded?

Thurs 8/30/12CMSC 100 -- Overview

34

Page 35: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Encode Name By 11 Encode Name By 11 DigitsDigits

First 6 digits: Manufacturer First digit, product category:

0, 1, 6, 7, 8, or 9: most products 2: store’s use, for variable-weight items 3: drugs by National Drug Code number

Last 5 digits: Manufacturer-assigned ID

Thurs 8/30/12CMSC 100 -- Overview

35

Page 36: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

ExamplesExamples

Labels: 0-72782-051440• 0=general product• 72782= Avery• 051440=Avery’s code for this product

Ponds: 3-05210-04300• 3=drug code• 05210= Unilever• 04300=National Drug Code for this product

Thurs 8/30/12CMSC 100 -- Overview

36

Page 37: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

12-Digit Number12-Digit Number The UPC folks decided to include another digit for

error checking. Example:• 01660000070 Rose’s Lime Juice (12 oz)• 04660000070 Eckrich Franks, Jumbo (16 oz)• 05660000070 Reese PB/Choc Egg (34 g)• 08660000070 Bumble Bee Salmon (14.75 OZ)

Misread digit #2 and you turn sweet to sour!

Thurs 8/30/12CMSC 100 -- Overview

37

Page 38: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Check DigitCheck Digit1. Add the digits in the odd-numbered positions (first,

third, fifth, etc.) together and multiply by three

2. Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result

3. Subtract the result from the next-higher multiple of ten. The result is called the check digit

Thurs 8/30/12CMSC 100 -- Overview

38

Page 39: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Code and ExampleCode and Example

• Lime juice: 01660000070→016600000708• Franks: 04660000070→046600000705• Choc Egg: 05660000070→056600000704• Salmon: 08660000070→086600000701

Thurs 8/30/12CMSC 100 -- Overview

39

set evensum to d2+d4+d6+d8+d10set oddsum to d1+d3+d5+d7+d9+d11set checkdigit to (0-(3*oddsum+oddsum)) mod 10

01660000070

01660000070odd-digit sum: 0+6+0+0+0+0=6even-digit sum: 1+6+0+0+7=14odd*3+even = 6*3+14=32subtract from multiple of 10=40-32=8

all are two digits

different now

Page 40: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Some (Mod) MathSome (Mod) Math 3 x Sodd + Seven = 0 mod 10

The sum of the odd-position digits (times 3) plus the sum of the even position digits (including the check digit) is 0 mod 10

Modulo math is just like regular math, except things wrap around (like an odometer). Mod 10 means we only pay attention to the last digit in the number

Divide by 10 and only keep the remainder

Thurs 8/30/12CMSC 100 -- Overview

40

Page 41: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

More Modulo MathMore Modulo Math What’s the check digit for the code 0-000000-000000?

What happens to the check digit if you add one to an odd-position digit?

What happens to the check digit if you add one to an even-position digit?

Behavior that matters: check digits for “similar codes” (which might be easily confused/misread) are different (reducing the probability they’ll be misread)

Thurs 8/30/12CMSC 100 -- Overview

41

Page 42: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

BitsBits We’ve gone from a product name to an 11-digit

number to a 12-digit number

A 0 will appear in the UPC as a white bar (space) and a 1 as a black bar So we need to turn each digit (base 10) into a series of

bits (base 2) Also, we want to be sure we alternate 0s and 1s often

enough (e.g., don’t want 20 black bars (1s) in a row) Finally, we want to have a code that we can scan in either

direction (i.e., we need to be able to tell which direction we’re reading it in)

Thurs 8/30/12CMSC 100 -- Overview

42

Page 43: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

• Encode d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 as:

101 d1 d2 d3 d4 d5 d6 01010 d7 d8 d9 d10 d11 d12 101

Thurs 8/30/12CMSC 100 -- Overview

43

Last 6 digits have 0s and 1s reversed. (No reverse complements can tell what direction we’re scanning in!)

Digits are encoded as 7-bit patterns that all:•start with 0, end with 1•switch from 0 to 1 twice•include no pairs of numbers that are the reverse of each other (“reverse complements”)

0: 00011011: 00110012: 00100113: 01111014: 0100011

5: 01100016: 01011117: 01110118: 01101119: 0001011

BitsBits

Page 44: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

How Many Bits?How Many Bits? Question: How many bits (zeros and ones) long is

the code for the original 12-digit sequence?

Thurs 8/30/12CMSC 100 -- Overview

44

Page 45: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Finally, Ink!Finally, Ink! Given the long pattern of bits, we write a 1 as a bar and

a zero as a space Two 1s in a row become a double-wide bar Two 0s in a row become a double-wide space No UPC has more than four 0s or 1s in a row.

Question: WHY? All digits have equal width All UPCs start and end with bars (actually with black-

white-black pattern) UPCs can be read upside down UPCs can be read at an angle or variable speed via

ratiosThurs 8/30/12CMSC 100 -- Overview

45

Page 46: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Example .......Example .......

Barcode for skin cream: 3-05210-04300-8

(8 is the check digit) start: 101; 3: 0111101 05210: 0001101-0110001-0010011-0011001-0001101 middle: 01010 04300: 1110010-1011100-1000010-1110010-1110010

(rev) 8: 1001000 (rev); end: 101 The digits underneath are for our benefit (the machine

doesn’t read them!)Thurs 8/30/12CMSC 100 -- Overview

46

Page 47: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

Whew!Whew!

The UPC example illustrates: Abstraction Binary numbers and modulo math Encoding (error correction, readability

constraints)

Thurs 8/30/12CMSC 100 -- Overview

47

Page 48: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

QR CodesQR Codes “QR” = “Quick Response Code”

QR codes are kind of like UPC codes...

...but the encoding is a lot more complicated: Different “versions” provide different resolutions

(which is why the pixels look bigger in some QR codes than others)

Variable data types and error correction levels Complex masking scheme enables variable

resolution, etc., but the algorithm to reconstruct the underlying content is much more sophisticated

No one pixel “means” anything like it does in a UPC code

Thurs 8/30/12CMSC 100 -- Overview

48

Page 49: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

QR... Coins??QR... Coins?? Last year, the Netherlands

introduced the first coins with a scannable QR code! Wave of the future... or total gimmick?

Thurs 8/30/12CMSC 100 -- Overview

49

Page 50: CMSC 100 Course Overview Professor Marie desJardins Thursday, August 30, 2012 Thurs 8/30/12 1CMSC 100 -- Overview

That’s It!That’s It!

Any last questions?

Enjoy your long weekend and I’ll see you on Tuesday!

Thurs 8/30/12CMSC 100 -- Overview

50