CPSC 111 Introduction to Computation section 102 September 10, 2009 - - PowerPoint PPT Presentation

cpsc 111
SMART_READER_LITE
LIVE PREVIEW

CPSC 111 Introduction to Computation section 102 September 10, 2009 - - PowerPoint PPT Presentation

CPSC 111 Introduction to Computation section 102 September 10, 2009 Based on slides by Kurt Eiselt, Paul Carter, Gabriel Murphy, Rachel Pottinger, Who I Am Cristina Conati Room 125, ICICS/CS building, 2366 Main mall Room 125, ICICS/CS


slide-1
SLIDE 1

CPSC 111

Introduction to Computation section 102

September 10, 2009 Based on slides by Kurt Eiselt, Paul Carter, Gabriel Murphy, Rachel Pottinger,

slide-2
SLIDE 2

Who I Am

  • Cristina Conati

– Room 125, ICICS/CS building, 2366 Main mall Room 125, ICICS/CS building, 2366 Main mall – conati@cs.ubc.ca

i f i b

  • Associate Professor, 10 years at UBC in November
  • Research: Artificial Intelligence and Intelligent User

I t f Interfaces

  • may tell you a bit more about this later in the course (if there

is time) is time)

  • There is more info on my web page

(www.people.cs.ubc.ca/~conati)

  • And in the following talk

http://videolectures.net/ijcai09_conati_its/

slide-3
SLIDE 3

What This Course Is About What This Course Is About

C l d d i ti B i i t t Calendar description: Basic programming constructs, data types, classes, interfaces, protocols and the design

  • f programs as interacting software components.

Prerequisites: Mathematics 12. Ignore the buzzwords for now. You’re going to learn about computers and how to put together f i t ti t k th d f l t ff sequences of instructions to make them do useful stuff.

slide-4
SLIDE 4

Who this course is for Who this course is for...

It i t d th t ill h d t i t It is expected that you will have used a computer prior to taking the course and that you are familiar with basic keyboard and mouse operations However, no prior programming experience is assumed. This course will teach you basic programming constructs that will allow you to unleash your creativity and develop your own applications software your own applications software. In other words, you can succeed here even if you have never ever written a computer program.

slide-5
SLIDE 5

but note this …but note this

There is a new course on Introduction to C t ti th t t t thi t (CPSC 110) Computation that starts this term (CPSC 110) Different programming language and different Different programming language and different approach to teaching intro programming You cannot be registered for both 110 and 111 If you want more info on CPSC 110, please contact Prof. Kurt Eiselt (eiselt@cs.ubc.ca)

slide-6
SLIDE 6

Also Also

You cannot be registered (get credits) for both CPSC 101 AND 111 if you are CPSC Majors

slide-7
SLIDE 7

Speaking of prerequisites Speaking of prerequisites...

Students with the following student ID numbers have not satisfied prerequisites for CPSC 111 Come see me after satisfied prerequisites for CPSC 111. Come see me after class to get your note from the CS department:

slide-8
SLIDE 8

Administrative Stuff Administrative Stuff

As long as we're talking about administrative d t il h details, here are many many more...

slide-9
SLIDE 9

First some departmental announcements: First some departmental announcements:

slide-10
SLIDE 10
slide-11
SLIDE 11

Resources Resources

There are other sections of CPSC 111:

101: M W F 9:00 – 10:00 Kurt Eiselt DMP 310 103: M W F 15:00 - 16:00 Wolfgang Heidrich DMP 310 BCS: M W F 11:00 - 12:00 Joseph Luk Don't go to this

Lectures may be slightly different slides may Lectures may be slightly different, slides may be slightly different But we’re covering the same material at same speed using same resources

  • (teaching assistants, labs, tutorials, homework, etc.).
slide-12
SLIDE 12

Resources

Your textbook is Big Java (third edition) by Cay H t (Wil d S )

If you have the 2nd

Horstmann (Wiley and Sons).

If you have the 2nd edition, it’s also OK

slide-13
SLIDE 13

But do make sure to get the textbook . Very g y soon!. By Tuesday, you should read Chapter 1

  • Chapter 1
  • Chapter 2.1 through 2.5
slide-14
SLIDE 14

Speaking of Reading the Texbook… p g g

  • Things that can help you do well in this course

– Read textbook *before* class – Ask lots of questions – remember, there is *no such thing* as a silly question thing as a silly question – Participate to class discussion – Work with your “neighbours” when I ask you to More on this later…

slide-15
SLIDE 15

More Resources

  • WebCT

– On‐line learning tool where to find labs, lecture notes, assignments, sample exams – Google webct Vista ubc, or go to http://www.vista.ubc.ca – Need a login id and password (your Campus Wide Login will do)

  • Use the WebCT “discussions” board to send questions on

Use the WebCT discussions board to send questions on course material (so read it regularly)

– Please don’t send these questions via email to instructors and Please don t send these questions via email to instructors and TAs

You’ll find out more about WebCT in Lab 1 You ll find out more about WebCT in Lab 1

slide-16
SLIDE 16

Yet More Resources

I post all my PowerPoint slides sometime after class. You can access them You can access them

  • from WebCT

directly from

  • directly from

http:/people.cs.ubc.ca/~conati/cpsc111/2009/Section_102.html

Until you get up to speed with WebCT you can find out more about CPSC 111 at http://www.ugrad.cs.ubc.ca/~cs111/ (you should probably write the URLs above down).

slide-17
SLIDE 17

And More Resources

  • Come to my office hours

– Tuesday 2:00pm – 3:30pm (tentative)

  • Go to the Demco Learning Centre (DLC), open several

hours every weekday to help you

– ICCS X150 near Reboot Cafe – will open probably next week, for more details google Demco Learning Centre or see http://www.cs.ubc.ca/ugrad/current/resources/cslearning.shtml)

slide-18
SLIDE 18

And EVEN MORE Resources

  • Go to labs (2h/week) and tutorials (1h/week)
  • will start next week
  • will start next week
  • Make sure your review the lab content and do pre-

lab readings to get the most o t of the labs lab readings to get the most out of the labs

  • Before next week, you should do Lab 0 (a take

home lab) available in WebCT.

  • You should also read the handout distributed today

– You will need this to take a short (20’) exploratory test during Lab 1 (test is not for marks)

slide-19
SLIDE 19

Remember

  • Tutorials aren't part of your grade, but they're great

educational opportunities You should go educational opportunities. You should go

  • Labs are part of your grade. Don't skip them.
  • Every year, some students skip the labs and are surprised

to find they have failed the course as a result. Why?

slide-20
SLIDE 20

Tentative grade calculation

10 labs 10% 3 assignments 10% Midterm exam 1 10% Midterm exam 2 20% Final exam 50% Please note that in order to pass the course you must:

  • obtain an overall grade of at least 50%
  • b a

a

  • e a g ade o a eas 50%
  • obtain a grade of at least 50% on the final exam
  • obtain an overall grade of at least 50% on the combined lab and

assignment grades If you fail to satisfy any of the above criteria, a grade no greater than 45% will be assigned in the course. The instructor reserves the right to modify this grading scheme as necessary throughout the term.

slide-21
SLIDE 21

Important Dates Important Dates

First midterm exam: Wednesday October 7 First midterm exam: Wednesday, October 7 6:30pm Second midterm exam: Wednesday, November 4 6:30pm Final exam: Sometime in December (dates usually announced (dates usually announced sometime in October)

slide-22
SLIDE 22

One More Note One More Note

  • Want an extra half mark on your overall class grade at the

Want an extra half mark on your overall class grade at the end of the course? D h

  • Do the survey at

http://www.surveyfeedback.ca/surveys/wsb.dll/s/1g29a b FRIDAY OCTOBER 18 by FRIDAY OCTOBER 18

  • Pointer also available in WebCT
slide-23
SLIDE 23

Challenge exam

Students who want to challenge this course by examination should

  • complete an application (on web page below)
  • submit it along with the application fee to the department
  • ffice no later than Friday at 12 noon.

Students who apply to write the exam will be t t d b il ith th ti d contacted by e-mail with the exam time and location (it will be sometime next week)

http://www.cs.ubc.ca/ugrad/info/planning/challenge111.shtml

slide-24
SLIDE 24

D ith Done with Administration! For now…

slide-25
SLIDE 25

Plan for the rest of the day Plan for the rest of the day

What is this Computer Science about Why it might be frustrating Strategies for success Why learn this stuff Introduction to computer hardware if time permits A little bit of programming if time permits A little bit of programming if time permits

slide-26
SLIDE 26

This is a first course in computer science This is a first course in computer science...

...but what is computer science? Is it the study of computers?

slide-27
SLIDE 27

This is a first course in computer science This is a first course in computer science...

...but what is computer science? "Computer science is as much about computers as astronomy is about telescopes " as astronomy is about telescopes. Edsger Dijkstra Edsger Dijkstra In fact many refer to the discipline as In fact, many refer to the discipline as “Computing science”

slide-28
SLIDE 28

In Other Words In Other Words

“C t i i th t d f h t “Computer science is the study of what computers do, not of what they are.” Kurt Eiselt

slide-29
SLIDE 29

So what do computers do? p

  • Computers have amazing physical/mechanical abilities

p g p y /

– Can count, aggregate and search much faster and more reliably than humans

  • No intellectual abilities

They are machines after all (turn it off and restart) – They are machines after all (turn it off and restart)

  • So you need to tell the computer what to do

So you need to tell the computer what to do And how on earth can we do that? And how on earth can we do that?

slide-30
SLIDE 30

Procedures processes and programs Procedures, processes and programs

A procedure is a collection of instructions in some i f l d th t lt i f l b h i meaningful order that results in useful behavior on behalf of the entity that executes the instructions. A process is what happens when a procedure is followed- it’s a procedure in execution. p When the instructions are written in a symbolic language that can be executed by a computer, the procedure is called a computer program procedure is called a computer program.

slide-31
SLIDE 31

Computer Programming

  • Programming teaches you a language to communicate

to the computer so that you can give procedures for it to the computer so that you can give procedures for it to execute

  • A computer program is nothing more than a sequence
  • f instructions to the computer
  • Java is the specific programming language that we will

l i thi ( thi l t ) learn in this course (more on this later)

slide-32
SLIDE 32

To Summarize To Summarize

What we do in CPSC 111 is think in terms of procedures use a programming language called Java to write the procedures as computer p p programs and execute the programs on a computer to generate useful processes

slide-33
SLIDE 33

Procedures and algorithms Procedures and algorithms

Computer people often use the words procedure d l ith i t h bl ill t and algorithm interchangeably...we will too.

An algorithm is An algorithm is

  • a finite procedure

itt i fi d b li b l

  • written in a fixed symbolic vocabulary
  • governed by precise instructions
  • moving in discrete steps, 1, 2, 3, ...
  • whose execution requires no insight, cleverness,

intuition, intelligence, or perspicuity

  • and that sooner or later comes to an end

and that sooner or later comes to an end

David Berlinski in The Advent of the Algorithm

slide-34
SLIDE 34

Procedures and algorithms Procedures and algorithms

Let’s dive right in and write a procedure or l ith j t f f algorithm, just for fun. Since it is almost lunch time we’ll make Since it is almost lunch time, we ll make…

slide-35
SLIDE 35

Fried Eggs (sunny-side-up) yum! Fried Eggs (sunny side up), yum!

slide-36
SLIDE 36

Procedures and algorithms Procedures and algorithms

Form a small group (2 or 3) with your neighbors. Grab some paper and a pen write down how to make fried-eggs as a sequence

  • f steps.

p Number each step.

slide-37
SLIDE 37

Procedures and algorithms Procedures and algorithms

Was that a little bit frustrating? If you had to depend on me for your lunch today, you might be quite upset right now you might be quite upset right now. Getting other people to do what you want them to g p p y do isn’t easy. Getting computers to do what you want them to do is less easy -- a lot less.

slide-38
SLIDE 38

Procedures and algorithms Procedures and algorithms

So let’s go back to our definition of algorithm.

  • a finite procedure
  • written in a fixed symbolic vocabulary
  • governed by precise instructions
  • moving in discrete steps, 1, 2, 3, ...
  • whose execution requires no insight cleverness

whose execution requires no insight, cleverness, intuition, intelligence, or perspicuity

  • and that sooner or later comes to an end

Why can we get quite frustrated when we start to learn to write programs to make computers do stuff?

slide-39
SLIDE 39

Procedures and algorithms Procedures and algorithms

Here’s why we get frustrated when we start to learn t it t k t d t ff to write programs to make computers do stuff:

An algorithm is An algorithm is

  • a finite procedure

itt i fi d b li b l

  • written in a fixed symbolic vocabulary
  • governed by precise instructions
  • moving in discrete steps, 1, 2, 3, ...
  • whose execution requires no insight, cleverness,

intuition, intelligence, or perspicuity

  • and that sooner or later comes to an end

and that sooner or later comes to an end We don’t have a lot of practice at being precise!

slide-40
SLIDE 40

Procedures and algorithms

Here’s why we get frustrated when we start to learn to write programs to make computers do stuff:

An algorithm is

  • a finite procedure
  • a finite procedure
  • written in a fixed symbolic vocabulary
  • governed by precise instructions
  • moving in discrete steps, 1, 2, 3, ...
  • whose execution requires no insight, cleverness,

intuition, intelligence, or perspicuity , g , p p y

  • and that sooner or later comes to an end

We don’t have a lot of practice at working with completely We don t have a lot of practice at working with completely empty heads.

slide-41
SLIDE 41

Why working with computers isn’t easy Why working with computers isn t easy

The languages that computers understand are very different from the languages that humans understand and for good from the languages that humans understand, and for good reason. Unlike computers, humans bring enormous amounts of knowledge to bear on the simple problem of figuring out what a sentence means. How do you interpret this sentence? I made her duck.

  • I cooked her a duck-based dish
  • I made her lower down
slide-42
SLIDE 42

Why working with computers isn’t easy Why working with computers isn t easy

When you're processing a sentence, you may not be able to articulate the knowledge that you’re using articulate the knowledge that you re using you may not really recognize that there are different meanings But you do have that knowledge, and most times you can y g , y apply it very effectively, as quickly as you read the sentence, to extract the right meaning

slide-43
SLIDE 43

Why is this important for you?

Because the natural language you use, whether English, Mandarin, French Klingon or whatever is highly ambiguous French, Klingon, or whatever, is highly ambiguous You deal with it automatically and unconsciously. Every sentence you write, every utterance you speak, lacks precision (to say the very least). You count on the receiving end to disambiguate it without even recognizing that the disambiguation is happening. It’s an inherent trait of natural language and the humans who understand

  • it. It’s what we do. It sets us apart from everything else.

You can’t assume any of this when working with computers

slide-44
SLIDE 44

Are we doomed then?

So now that you know you're not precise enough to explain to someone else how to make fried eggs, how will you ever gg , y write a working computer program? Stick with us for 13 weeks! Stick with us for 13 weeks! In this class you will learn how to write those programs, and h t b ffi i tl i how to be sufficiently precise. Everyone starts out imprecise and everyone gets frustrated y p y g while learning this stuff. You are not alone. You can succeed at this. But you have to forget about fried eggs for lunch. Sorry.

slide-45
SLIDE 45

Remember… Remember…

“Amazingly, everything you’ve ever seen a computer do

Amazingly, everything you ve ever seen a computer do is the result of a sequence of extremely simple arithmetic and logical operations done very quickly. The challenge for software developers is to devise instructions that put those simple operations instructions that put those simple operations together in ways that are useful and appropriate.” – Tomorrow’s Technology and You, Beekman and Quinn Quinn

slide-46
SLIDE 46

How to avoid frustration How to avoid frustration

Practice, practice, practice. This material isn't conceptually incomprehensible, but... It takes a lot of practice to learn to be precise enough to make a computer do what you want It takes a lot of practice to keep from assuming that the computer is smarter than it really is It takes a lot of practice to get good at this stuff

slide-47
SLIDE 47

How to avoid frustration How to avoid frustration

Learning to write computer programs is similar to learning a new language (ITALIAN!) new language (ITALIAN!) It’s a skill. Skill requires practice. You wouldn’t put off all your italian practice until the night before your exam. y You don’t want to put off all your programming practice until the night before a programming assignment is due or (worse the night before a programming assignment is due or (worse yet) until the night before your exam. Practice, practice, practice.

slide-48
SLIDE 48

How to avoid frustration How to avoid frustration

Study your book frequently (don’t just read it). Play with the programs from your book and from class. Go to the labs. Go to the tutorials. Ask questions. Practice, practice, practice.

slide-49
SLIDE 49

Don’t wait until the last minute to get help

slide-50
SLIDE 50

Bad things happen while learning a new skill Start Bad things happen while learning a new skill. Start homework early; give yourself time for mistakes.

slide-51
SLIDE 51

Don’t be too ambitious with your course load. You can’t slack off in this class, even for a few days.

slide-52
SLIDE 52

So what will you learn here? So what will you learn here?

How to get a computer to do your bidding:

  • How to represent solutions to problems as

procedures or algorithms procedures or algorithms

  • How to represent those procedures as

p p programs written in a programming language

  • How to get the computer to turn your programs

into processes that do useful stuff

slide-53
SLIDE 53

Why should you learn it? Why should you learn it?

Look around you, computers are everywhere! CS has changed the way we work, study, communicate have fun! communicate, have fun! CS is leading advancements in many other fields g y

  • medicine
  • math

h i

  • physics
  • biology
  • education
  • psychology
  • ……..
slide-54
SLIDE 54

Thinking in terms of process is crucial Thinking in terms of process is crucial

…formulas are no longer sufficient for describing h ld k F l how our world works. For example,

  • Economic systems are processes
  • Economic systems are processes
  • Political systems are processes
  • How HIV invades cells is a process

p

  • How pharmaceuticals interfere with HIV is also a

process, and so on… Being able to think about complex systems in terms

  • f procedures and processes will be of value to you
  • f procedures and processes will be of value to you

even if you never write another program after 111.

slide-55
SLIDE 55

Next Week Next Week

  • On Tuesday I will be away at a conference in

On Tuesday I will be away at a conference in Holland

  • Prof. Wolfgang Heidrich will be the guest lecturer
  • Labs and tutorials begin