Inft1004 Lec1 Introduction Small
Transcript of Inft1004 Lec1 Introduction Small
-
7/27/2019 Inft1004 Lec1 Introduction Small
1/18
1
INFT1004
Visual Programming
Lecture 1Introduction to Visual Programming
(Guzdial & Ericson chapter 1, 2)
3
WEDNESDAYTUESDAYMONDAY THURSDAY FRIDAY
8:00 - 9:00
9:00 - 10:00
10:00 - 11:00
11:00 - 12:00
12:00 - 1:00
1:00 - 2:00
2:00 - 3:00
3:00 - 4:00
5:00 - 6:00
6:00 - 7:00
4:00 - 5:00
INFT1004
Tut4
INFT1004Tut 2
ICT3.37
ICT3.44INFT1004Lab 1
ICT3.44 INFT1004Tut 5
ICT3.44
INFT1004Tut 6
ICT3.44
Consultation ICT3.20
INFT1004Tut 3
ICT3.44
INFT1004Lecture
GP 201
INFT1004Tut 5
ICT3.44
D
avid
Ilung
Ilung
4
INFT1004 - SEMESTER 1 - 2012
Week 1
Week 2
Week 3
Week 4
Week 10
Week 11
Week 9
Week 12
Mar 4
Mar 11
Mar 18
Mar 25
May 6
May 13
May 20
May 27
Assignment due3:00 Tuesday May 21
Programs, Arrays and Iteration
Working with x and y coordinates
Selection
Web, Representations, Steganography
Lists, Files and Modules
Turtles and Other Classes
Introduction
Week 13 Jun 3
Revision and Look Ahead
No formal classes
Mid Year Examination Period - MUST be available normal & supplementary period
Recess Apr 1 - Apr 7 Mid Semester Recess Period
Practical Test 2
in Lab class
Week 8 Apr 29
More Sound and ArraysWeek 7 Apr 22
Program Design and Strings
Lecture Topics and Lab topics are the same for each week
LECTURE TOPICS
Week 5 Apr 8 Practical Test 1in Lab classMore Picture Techniques
Week 6 Apr 15 Sound and Arrays
5
Course coordinator / Lecturer / Tutor
Keith Nesbitt
ICT3.20
www.knesbitt.com
My Contact Details
Perception and cognition
Visualisation / Sonification
Computer gamesVirtual reality
Algorithms and Patterns
Creativity
Research
Interests
-
7/27/2019 Inft1004 Lec1 Introduction Small
2/18
2
6
Ilung Pranata
ICT3.17
Information Security
Trust
PrivacyCloud computing
Digital environments
Research
Interests
Tutor
7
David Cornforth
Tutor
Data Mining
Neural Networks
Evolutionary ComputationHealth informatics
Complex Systems
Multi agent system
Research
Interests
8
The University has given you a studentmail address.
Use it. If the Uni wants to contact you, it does sovia this address.
Technically, Uni staff are not permitted to reply to
email apparently from a student, but from someother address.
Your Contact Details
9
The University has given you a studentmail address.
Use it. If the Uni wants to contact you, it does sovia this address.
Technically, Uni staff are not permitted to reply to
email apparently from a student, but from someother address.
Your Contact Details
If you dont want touse the studentmailsystem regularly, setyour account toforward to yourpreferred address . . .
-
7/27/2019 Inft1004 Lec1 Introduction Small
3/18
3
10
The University has given you a studentmail address.
Use it. If the Uni wants to contact you, it does sovia this address.
Technically, Uni staff are not permitted to reply toemail apparently from a student, but from someother address.
Your Contact Details
. . . andremember
to log in and deletemail now and then,so that your mailboxdoesnt fill up andreject any furtherincoming messages.
11
Assessment
Practical test 1
15%
Practical test(in lab class week 5)worth 15%
practice test in week before
12
Assessment
Practical test 1
15%
Practical test 2
15%
Practical test(in lab class week 5)
worth 15%
practice test in week before
Practical test 2(in lab class week 9)worth 15%
13
AssessmentPractical test(in lab class week 5)worth 15%
practice test in week before
Programming assignment(due by start of week 11 lecture)
worth 20%
students may work in pairs for this assignment
Practical test 1
15%
Practical test 2
15%
Assignment
20%
Practical test 2(in lab class week 9)worth 15%
-
7/27/2019 Inft1004 Lec1 Introduction Small
4/18
4
14
Assessment
Practical test 1
15%
Practical test 2
15%
Assignment20%
Final examworth 50%
make sure youve available for the whole ofthe exam period (normal and supplementary)
Final Exam
50%
Practical test(in lab class week 5)worth 15%
practice test in week before
Programming assignment(due by start of week 11 lecture)
worth 20%
students may work in pairs for this assignment
Practical test 2(in lab class week 9)worth 15%
15
Assessment
Practical test 1
15%
Practical test 2
15%
Assignment20%
Final Exam
50%
Students must
attain 50% overallto pass the course
16
Text Book
Introduction to Computing and
Programming with Python (3rd edn)
Mark Guzdial & Barbara Ericson
(Pearson, 2013)
Offers explanatory text
and worked examples.
17
Text Book
Every Week
Read and understand theexplanations.
Complete the examplesand activities.
Be sure you have acomfortable command of
the language features
-
7/27/2019 Inft1004 Lec1 Introduction Small
5/18
5
18
Myth Busters #1
The lectures will sometimes use completely
different examples, to offer you alternativeexplanations of the topic.
Therefore you should both attend the lectures
andread and work through the book.
I don't need a Textbook
19
Myth Busters #2
No - I am a Lecturer
If you look in a mirror you will see the teacher.
The textbook is very handy to help thisprocess.
I am a Teacher
20
Myth Busters #3
Email works well
21
Myth Busters #3
Email works well
-
7/27/2019 Inft1004 Lec1 Introduction Small
6/18
6
22
Myth Busters #3
This is not an online course although many
materials will be available on Blackboard.
It is assumed that you are attending lecturesand labs.
You should see me during these times.
Email works well
23
Blackboard
Note - lectures and tutorial information is here.
It contains weekly lab notes and exercises (even
for week 1) - It contains lecture slides
You will submit assignments through blackboard(Cover sheets will be submitted as hard copy).
It contains an electronic copy of the course outline
24
Blackboard
25
Course outline
Note the bits about handing in work late.
Note the bits about what to do if your work isaffected by illness or other acceptableadverse circumstances. (You will follow thesame process for all assessment items)
The lecture topics in the course outline areindicative only and may vary so you shouldcheck the course Blackboard website weeklyfor course updates, bulletins, and additionalresources
-
7/27/2019 Inft1004 Lec1 Introduction Small
7/18
7
26
Rest of course outline
Note what it says about plagiarism, which theUni takes very seriously.
Note the different dates for withdrawing fromthe course, and think about what they mightmean to you.
27
INFT1004 Visual Programming
This course will teach you to
test and document your program solutionsaccording to suitable standards.
code the solution algorithm in a specificprogramming language (Python)
comprehend a programming problemand design a solution algorithm
Analyse the
problem
Design the
solution
28
INFT1004 Visual Programming
This course will teach you to
test and document your program solutionsaccording to suitable standards.
code the solution algorithm in a specificprogramming language (Python)
comprehend a programming problemand design a solution algorithm
Analyse theproblem
Implement
the code
Design thesolution
29
INFT1004 Visual Programming
This course will teach you to
test and document your program solutionsaccording to suitable standards.
code the solution algorithm in a specificprogramming language (Python)
comprehend a programming problemand design a solution algorithm
Analyse theproblem
Implement
and documentthe code
Test the code
solves the problemand meets standards
Design thesolution
-
7/27/2019 Inft1004 Lec1 Introduction Small
8/18
8
30
INFT1004 Visual Programming
This course will teach you to
comprehend a programming problemand design a solution algorithm
Analyse the
problem
Implementand document
the code
Test the codesolves the problem
and meets standards
Design the
solution
The first of these is generally the hardest;
some people find it all but impossible.
Lets give it a try right now!
31
Problem solving
Making a piece of toast
What are the steps involved? (sequence)
Are there decisions to make? (selection)
What if you work in a
breakfast bar and need to
make 10 pieces of toast? (iteration)
32
programming is
something
that you need to
practice!!
33
How to Surf ?
1. Paddle really fast when a wave is coming.2. Stand up when you have caught the wave.
3.Turn a bit, get tubed, do some air etc.
4. If the wave closes out then jump off!
-
7/27/2019 Inft1004 Lec1 Introduction Small
9/18
9
34
How to Surf ?
Who feels like they can surf now?
Well programming is just like this
I can tell you how to do it and it might even
seem pretty easy (its not)
- YOU NEED TO PRACTICE!
35
programming is
something
that you need to
practice!!
36
Programming Programming is deciding on a set of instructions
that will get the program to do the required job,then writing those instructions in the form required
by the computer (recipe).
It often also involves a debugging processintended to eliminate problems in the program(which can sometimes be a frustrating and lengthy
experience). You cannot learn to program by reading and
watching; it takes incredible amounts of practice.
Programming courses almost always take moretime per week than any other courses.
37
Programming Programming is deciding on a set of instructions
that will get the program to do the required job,then writing those instructions in the form required
by the computer.
It often also involves a debugging processintended to eliminate problems in the program(which can sometimes be a frustrating and lengthy
experience). You cannot learn to program by reading and
watching; it takes incredible amounts of practice.
Programming courses almost always take moretime per week than any other courses.
Analyse theproblem
Implement
and documentthe code
Test the code
solves the problemand meets standards
Design thesolution
-
7/27/2019 Inft1004 Lec1 Introduction Small
10/18
10
38
Programming Programming is deciding on a set of instructions
that will get the program to do the required job,then writing those instructions in the form required
by the computer. It often also involves a debugging process
intended to eliminate problems in the program(which can sometimes be a frustrating and lengthy
experience).
You cannot learn to program by reading andwatching; it takes incredible amounts of practice.
Programming courses almost always take moretime per week than any other courses.
39
Programming Programming is deciding on a set of instructions
that will get the program to do the required job,then writing those instructions in the form required
by the computer. It often also involves a debugging process
intended to eliminate problems in the program(which can sometimes be a frustrating and lengthy
experience).
You cannot learn to program by reading andwatching; it takes incredible amounts of practice.
Programming courses almost always take moretime per week than any other courses.
40
Traditional or object-oriented
Traditional
programming
Object-oriented
programming
a program is a
long sequence ofinstructions, often
involving choice
and repetition.
consists of lots of
objects (things), eachof which can have its
own little sequences
of instructions.
PROGRAMTriangle_Ar eaIMPLICITNONETYPE triangle
REAL:: a,b, cENDTYPE triangleTYPE(triangle):: tPRINT*,'Welcome,please enterthe&
& lengthsofthe 3sides.'READ*,t%a,t%b,t%cPRINT*,'Triangle''sarea: ',Area(t)
CONTAINSFUNCTIONArea(tri)IMPLICITNONEREAL:: Area !functiontypeTYPE(triangle),INTENT(IN):: triREAL:: theta,heighttheta = ACOS((tri%a**2+ tri%b**2-tri%c**2)/ (2.0*tri
%a*tri%b))height = tri%a*SIN(theta); Area = 0.5*tri%b*height
ENDFUNCTIONAreaENDPROGRAM Triangle_Area
Picture
width
height
Picture
width
height
Picture
width
height
41
Traditional or object-oriented
Traditional
programming
Object-oriented
programming
a program is a
long sequence ofinstructions, often
involving choice
and repetition.
consists of lots of
objects (things), eachof which can have its
own little sequences
of instructions.
PROGRAMTriangle _AreaIMPLICITNONETYPE triangle
REAL:: a,b,cENDTYPE triangleTYPE(triangle):: tPRINT*,'Welcome,please enterthe&
& lengthsofthe 3sides.'READ*,t%a,t%b,t%cPRINT*,'Triangle''sarea: ',Area(t)
CONTAINSFUNCTIONArea(tri)IMPLICITNONEREAL:: Area !functiontypeTYPE(triangle),INTENT(IN):: triREAL:: theta,heighttheta = ACOS((tri%a**2+ tri%b**2-tri%c**2)/ (2.0*tri
%a*tri%b))height = tri%a*SIN(theta); Area = 0.5*tri%b*height
ENDFUNCTIONAreaENDPROGRAM Triangle_Area
Picture
width
height
Picture
width
height
Picture
width
height
-
7/27/2019 Inft1004 Lec1 Introduction Small
11/18
11
42
Python is object-orientedObject-oriented
programming
consists of lots ofobjects (things), eachof which can have its
own little sequencesof instructions.
Python is object-oriented
(well be dealing with objects right from the start)
43
Names are important
Many of the objects well deal with have names.
Names are really important, because when we tell
the program, say, to display a picture, we need totell it which picture to display.
If weve given that picture a name, this is easy.
Soon well give it a try . . .
44
Names are important
If weve given that picture a name, this is easy.
Soon well give it a try . . .
pLecturer
45
Python, Jython, JES
There are many, many programming languages
Some are easy to learn; others are widely used
professionally; others are for very specific purposes . .
-
7/27/2019 Inft1004 Lec1 Introduction Small
12/18
12
46
Python, Jython, JES
Were going to use Python, a language that is
easier than some to learn, and is used fairly widely,especially with web applications
The version were using is called Jython It is
Python written in another language called Java
(Python is typically written in C another language)
47
Python, Jython, JES
Were using it in an environment called JES
(Jython Environment for Students)
which includes
lots of featuresfor programming
with pictures
and sounds
48
Downloads
You can download JES (ver 4.3) and related bits
and pieces from the Media Computation site atGeorgia Tech, where the textbooks authors work
http://code.google.com/p/mediacomp-jes/
Its all pretty easy to install (Windows or Mac)
More detail is given on the notes for week 1
49
JES
mac version
program area
command area
-
7/27/2019 Inft1004 Lec1 Introduction Small
13/18
13
50
The JES panes
The top pane of JES is called the program
area; thats where well write programs
The bottom pane is called the command area;thats where we can type individual commands
for JES to execute immediately
program area
command area
51
The JES panes
For this week, all the typing we do in JES will
be in the command area
We can also configure JES (Window Layoutmenu) to show a help area or a watcher area
(which well explain later)
program area
command area
This is also called the
interactions area
52
JES and ObjectsIn JES, type file1=pickAFile() and press Enter
Choose a picture file, eg beach.jpg, from themediasources folder that goes with the textbook
You now
have an
object called
file1, andthat object is
a file
(ie an object of
type file)
53
JES and ObjectsType pic1=makePicture(file1) and press Enter
You now have another object called pic1, and that
object is a picture
-
7/27/2019 Inft1004 Lec1 Introduction Small
14/18
14
54
JES and Objects
Note you will have to type show(pic1) to
see the picture
Everything in a programming environment hasa type: file and picture are just two examples
of types (classes)
Different types (classes) can have different
things done with them
55
= doesnt mean equals
The = symbol is one of the trickiest concepts in
programming
x = y does not mean x is equal to y
It means take the value of y (whatever that is) and
assign it to the thing called x
y
x
4x = y
56
= doesnt mean equalsThis is called an assignment statement
Its an instruction, not a statement of fact
Once this one has been done, the variable called x will
have the same value as y
The assignment statement takes the value of whats on its
right and assigns it to the variable on its left
y
x
4 y
x
4
4
x = y
57
Print has nothing to do with printers
Python has a print command
In the lower pane, the command area, type
print(file1)
and then type
print(pic1)
Print doesnt send things to the printer; it
displays them on the screen
-
7/27/2019 Inft1004 Lec1 Introduction Small
15/18
15
58
Print has nothing to do with printers
With objects, it doesnt display the object itself; it
displays information about the object
With simpler things, like numbers, it displays
them directly try...
print(13)
print(-8.275)
print("My name")
59
Jython can do maths
Here are some things to try and to work at understanding:
print(513 * 25)
simon = 513 * 25
print(simon)
keith = "That is my name"
print(keith)
print(2 + 5 * 8)
quotient = 13 / 2
print(quotient)
print(13.0/2)
60
Weve just met some more types
integer a whole number
float a number with a decimal point (even if thedecimal point is followed by zeros)
string a sequence of characters enclosed in
quotation marks
61
Weve just met some more types
Weve also reinforced that different types can havedifferent things done with them
Division of two integers always gives an integer resultDivision of two numbers when at least one is a floatgives a float result
Dont forget this, or youll be puzzled now and then
-
7/27/2019 Inft1004 Lec1 Introduction Small
16/18
16
62
Exploring pictures
You probably still have file1 and pic1; if not, go back and
get them again (see the slide called JES and objects)
explore(file1)
JES knows that this is a file, and cant be explored
explore(pic1)
See how the explore tool lets you check out each
individual pixel of a picture
65
getPixel
pix = getPixel(myPic, 7, 7)
0 1 2 3 4 5 6 7
01234567
-
7/27/2019 Inft1004 Lec1 Introduction Small
17/18
17
66
Playing with Pixels
We can name individual pixels in the picture
pixel1 = getPixel(pic1, 32, 32)pixel2 = getPixel(pic1, 33, 33)
setColor(pixel1, yellow)
setColor(pixel2, yellow)
explore(pic1)
67
Playing with Pixels
We can name individual pixels in the picture
pixel1 = getPixel(pic1, 32, 32)
pixel2 = getPixel(pic1, 33, 33)
setColor(pixel1, yellow)
setColor(pixel2, yellow)
explore(pic1)
Notice that when you explore the picture again, you get another
window; explore doesnt have a refresh option
Notice that you can repeat a command by using the up-arrow key toget to it
You can also edit it before repeating it
68
Exploring Sounds
file2 = pickAFile()
This time pick a .wav file try ThreeWords.wav
sound2 = makeSound(file2)
print(sound2)
explore(sound2)
print(getSampleValueAt(sound2,14193))setSampleValueAt(sound2,14193,0)
explore(sound2)
69
Exploring Sounds
file2 = pickAFile()
This time pick a .wav file try ThreeWords.wav
sound2 = makeSound(file2)
print(sound2)
explore(sound2)
print(getSampleValueAt(sound2,14193))setSampleValueAt(sound2,14193,0)
explore(sound2)
This is just a taste of things; well explain it more later
Next week well write our first programs
-
7/27/2019 Inft1004 Lec1 Introduction Small
18/18
18
70
Weekly Notes
Every week, in addition to the lecture slides and
occasional demo programs, there will be a set of notes.
These will explain whats to be done in the lab class, andgive you any additional information we think you might
require.
Youll need to do a lot of your programming at home.
The textbook tells you how to get hold of the software
well be using, but theres a simplified set of instructions
in this weeks notes.
71
What to do before next week
Get JES installed on your computer
Dont just read the examples from Guzdial & Ericson; do them
Read through chapters 1 & 2 of Guzdial & Ericson:
Read my notes, (on blackboard), which correct or
comment on things the textbook says
Have a go at the problems at the end of each chapter
72
Thats the end of the lecture . . .
This week there are no tutorials (labs)
You are strongly advised to bring a
USB drive to the labs, so that you can
transfer your programming workbetween the lab, other computers at
uni, and home
73
Myth Busters #4
It's good to have fun. But you need to work hard.
I would advise you work hard first and play after thework is done (its hard to catch up get ahead)
Dates on the Calendar are much closer together
than they seem.
Uni is just a place to party