Lecture-1 - Peer Instruction for Computer Science

advertisement
CSE3: Fluency in Information
Technology
Dr. Beth Simon
Write these
down
Computer Science and Engineering
http://csemoodle.ucsd.edu
CSE B270: Lab
CSE3 Fluency with Information
Technology
• Why are you here?
– Most of you – Freshmen in Sixth College
Culture, Art and Technology
– Psychology Majors
– Computer Science Majors
– Anyone interested in getting computing
skills that will set them apart in their
field
• You are also…
Handout
Computer Users!
• We all use computers every day, often without
thinking about it
– Phone, iPod, TV
– Car
– Facebook, txting
• But, what will be next?
• What do you need to know about the world that
hasn’t yet arrived?
– How can you (in your career) help CREATE the new world?
– We don’t want you to be YOUR parents in 20 years
Nation-wide Effort to Define
21st Century Citizens
• Why does everyone have to study
– Reading
– Writing
– Arithmetic
Nation-wide Effort to Define
21st Century Citizens
• Why does everyone have to study
– Reading
– Writing
– Arithmetic
Nation-wide Effort to Define
21st Century Citizens
• Today, a baseline understanding of the power
of computers is necessary for:
– An informed populace
– Breakthroughs in most any field
– Successful businesses
– Bringing new capabilities to our everyday lives!
Your major doesn’t matter
What Does This Course Offer You?
• Globally-competitive, 21st Century professional
• Poised to tackle a broad range of societal challenges
and opportunities
• In a wide range of professional contexts
“It has given me confidence that
I’m able to figure things out on
a computer that I never would
have thought that I could do.”
Change View of Technology
“Now, every time I find myself playing a
video game, I actually understand what
makes it work.
That these games are not magically
produced, that it takes time, skill, and
sufficient funds to create these games.
I appreciate these games more than
before taking this class..”
Analysis Skills
“Programming allows a person to think
more logically, thinking in order and
debugging allows the user to gain valuable
problem solving skills.
Aspiring to go to law school, thinking
logically is extremely important and I
think this has helped.”
Communication Skills
“In today’s technologically-centered
world, using a program like Alice gives us
valuable exposure to discussing things
technically with other people and
explaining clearly what we are trying to
do.”
Organizational Skills
“Through Alice, I learned to stay
organized and structured in anything I
do, including studying for other classes.
Although at first, thinking with several
concepts at a time was very difficult, now
I am more confident.”
How are you going to accomplish
this?
• We’ll teach you to “write programs” (in Alice)
– But only because it’s the simplest way to interact
with a computer
• But really you get:
– To know what computers can do
– How to interact with computers “logically” – at
their level
– How to communicate effectively in technical
situations
– How to apply organizational skills in managing
data and tasks when using computers
Our Primary Goal*:
In the future,
No matter what application you use,
no matter the field you are in,
You can apply what you learn in this
course to figuring out a new application
or developing a new way to solve
problems in your field using computers.
* Primary complication:
You may have a limited idea of how exactly this will benefit you.
Who am I?
• Dr. Beth Simon (call me Dr. Simon)
– PhD in Computer Science and
Engineering
– Computer Architecture, Compilers,
Supercomputing
• Intel: Itanium compiler optimizations and
branch prediction schemes
• San Diego Supercomputer Center:
Advise the DoD in spending $$ millions
annually on supercomputers
Now hear this…
• My primary focus is on teaching THIS class
– My research is in how people learn about
computing!
• I’m VERY excited to have the opportunity to
work with you!
– Passionate about the value of this class on your
future, could you please go out and:
• Find a cure for cancer, leukemia, genetically-tied diseases
• Develop solutions to enable travel, etc., without using up
earth’s resources
• Help returning vets manage their psychological issues
• Develop the next cool device that changes my life
Just So You Know:
This class is different
• There are 2 CSE3 lectures
– They are not inter-changeable, you are expected
to attend your assigned lecture
• MWF 12-1: standard lecture format
• MW 4:30-5:50: active-learning format
• We hope you will stay in your currently
assigned section
– But it is your choice, if you feel strongly, you may
switch sections (you’ll need to drop and add a
new lab)
This class is BIG
• But I really, REALLY want to provide you as
much individual support as possible!
– I WANT you to ask questions!
• Have YOU ever asked a question in such a
large class?
Let’s Practice!
• Please, put a hand in the air.
• Repeat after me:
Let’s Practice!
• Please, put a hand in the air.
• Repeat after me:
I have a question
One more time…
• Please, put a hand in the air.
• Repeat after me:
One more time…
• Please, put a hand in the air.
• Repeat after me:
I didn’t get what you
just said, can you
explain it again?
Rest of Logistics on Class Web Site: Exams, etc. YOUR RESPONSIBILITY TO READ IT
Don’t forget to go to lab
(starting next week)
• Everyone registered for this class by registering
for a specific 2-hour lab section.
– Start going next week.
• Labs are in B270 (CSE)
– Go early, it takes time to
find it – it’s in basement
• If you are ever sick/miss
your lab, try to go to a later
one (but you must request
permission!)
NEXT CLASS:
• You will need to sit in your assigned seat
– Room Number and Seat Number on
csemoodle.ucsd.edu
• If you added class this week, you may not be there yet,
check back Thursday morning.
– Why? It’s a secret. But, it’s a good thing
• You MUST bring your iclicker (bookstore)
NEXT CLASS:
YOU
UPseatAND
• You willMUST
need to sit LOOK
in your assigned
– Room Number and Seat Number on
WRITE
DOWN YOUR
csemoodle.ucsd.edu
– Why? It’s a secret.
But, I promise
you,YOUR
you will
ASSIGNED
SEAT
ON
like what goes along with it. Tutors?
CALENDAR!!!!
• You MUST bring your iclicker (bookstore)
TO
DO
Let’s Jump In!
But First BY NEXT CLASS
• Go to class website and do items under Week
1: http://csemoodle.ucsd.edu (survey, etc.)
• Go to the lab (B270) and do Appendix A.
– Everyone in B270 is a CSE3 student or tutor
– Tutors in B270 randomly today, tomorrow and
Wed. if you would like help or to ask questions.
TO
DO
Let’s Jump In!
But First BY NEXT CLASS
• Read Chapter 1 and 2 and do the homework
– There’s a homework (small) due before
each lecture
– Homework has you reading the textbook
and “playing” around with Alice
– You don’t turn it in, you answer some questions
at the beginning of next class (aka a “quiz”) with
your clicker
Introduction to Alice
Alice is named in honor of
Lewis Carroll’s Alice in Wonderland
Alice
A modern programming tool
3-D graphics
3-D models of objects
Animation
Objects can be made to move around the
virtual world (a video game or simulation
implemented in 3-D)
We recommend you download latest
version from the web (if you have your own
computer – not required)
www.alice.org
What will YOU be doing with
Alice?
Make movies
Example: Snowman Seeking Snowwoman…
We’ll build this ourselves in a minute!
Make interactive “worlds”
Example: video game
Whack a Mole
Example: user-driven virtual world
Flight Simulator (see Examples with Alice)
Important Metaphor:
Two “genres” of challenges in movies and
games:
3-D animation (not programming, art)
Programming (controlling what happens)
Knowing how to program is like knowing
how to cook:
If you “can cook”, the ingredients you use
aren’t really an issue
Programming: Knowing HOW to Cook
3-D Manipulations: Just some ingredients
We’ll come back to this again…
Today: Chapters 1 and 2!
Give you an overview of how to
Design a story
Implement that story using Alice programming
language
PLAY your story (called running your program)
Prepare you for lab next week
Where you will make your own story
DON’T TAKE NOTES
Watch and try to understand WHY
These slides (with “ink”) posted on moodle
after class
AND Audio Podcast (link on moodle)!
Demos: NEVER TAKE NOTES
Preview Slide:
List of things you should be watching for in
demo
Notes Slides:
Right after Preview Slide
Your “notes” from the demo
So you can pay attention
BUT: This is still important material!
What you will see next:
Make a new World
Adding Objects
3 Dimensions and 6 Directions
Some tools for managing your 3-D world
Objects: What they are and have
Next: 7 Slides are your notes for this demo
For you to review and remember what we did
Demo: A new world
Create a new world
File  New
Choose template
Demo: Adding objects
3 Dimensions, 6 Directions
A 3D object has
3 dimensions
height, width, depth
6 degrees of freedom (directions of movement)
Techniques and Tools
Mouse is used to
approximately position objects in the scene
Camera Navigation is used to
set the camera point of view
Drop-down menu methods are used to
resize objects
more precisely position objects in the scene
Quadview is used to
position one object relative to another object
Objects
An "object" is
any thing that can be identified as unique
from other things
How is an object unique?
has a name
has properties:
width, height, color, location
can perform actions (methods):
associated actions it can perform
tasks it can carry out
Object Parts
Objects may be composed of parts
Demo: Saving a world
Writing and testing an animation is an
intense load on the computing system – a
crash can occur.
Best solution:
save your world every 15 minutes
Itchy save button
also save to a backup system
(for example, a USB memory key)
TO
DO
Getting Comfortable with
Setting Up Worlds/Objects
Appendix A (pg 311-330) or linked from
moodle
Complete on your own in lab B270 in CSE
Building, tutors available
BY NEXT CLASS
Or complete on your own computer
2 Sides to Using Alice
3-D Animation Effects
Important for making your work “look good”
(e.g. be what you want)
Issues of how you situate your world/objects
Components of “objects”
Tongue, Arm, Joint, etc.
These are the foods you cook with
Bananas versus milk versus steak
NEXT: How to Cook (program)
Programming Concepts: Class
Objects are categorized into classes
peter
paul
Person
mary
spike
Each object is
an instance of the class.
scottie
Dogs
fluffy
All objects in a class have similar properties
and generally can perform the same tasks.
Designing and Implementing*
Animation Programs
Step 1 – Design
Scenarios and Storyboards
*Implementing is a computing term meaning, basically, building
Step 1: Design
Decide on the problem to be solved
We provide or you choose
Design a solution
We will use a storyboard design
Example:
Snowman Seeking Snowwoman
The scenario is:
Several snow-people are outdoors, on a snowcovered landscape. A snowman is trying to meet
a snowwoman who is talking with a group of her
friends (other snowwomen.) He says "Ahem"
and wiggles his eyes, and she turns to
look at him.
Next Design.
Storyboard
Option 1: Sketches
None
Storyboard
Option 2: Screen Shots
Initial scene
Snowman tries to
catch snowwoman’s
attention
Snowwoman looks
around
Storyboard
Option 3: Text (whew)
Animation Artists sketch their storyboards
You may not have such expertise, so here is a
textual form that can be used:
Do the following actions in order
snowman turns to face snowwoman
snowman “wiggles eyes” and calls out to the
snowwoman.
snowwoman turns to look at him.
Storyboard
Option 3: Text (whew)
Do the following actions in order
snowman turns to face snowwoman
snowman “wiggles eyes” and calls out to the
snowwoman.
snowwoman turns to look at him.
This is like an ORDERED "to-do" list.
The Learning to Program in Alice textbook
puts a textual storyboard in a box.
Designing and Implementing*
Animation Programs
Step 2 – Implementation
Creating an Animation Program
(in Alice**)
*Implementing is a computing term meaning, basically, building
**Alice is a programming language (like Java or C++)
Step 2: Implementation
Translate the actions in the storyboard to a
program (in the Alice programming
language).
Program (a.k.a. script)
a list of instructions to have the objects
perform certain actions in the animation
Volunteer Needed: Read English
Demo Alert! Preview
Next: 9 Slides are your notes for this demo
For you to review and remember what we did
Take each line of storyboard and translate into
instructions
Some SB lines translate into multiple instructions
Methods: perform actions on objects
Note: Methods in lower left are used to control actions
(build programs).
They change depending on the object you
click on (in tree or in world)
Action Blocks control timing (together, in order)
Test after each little thing
Comments
Writing the Program
Our planned storyboard (ordered to-do list)
is:
Do the following actions in order
snowman turns to face snowwoman
snowman “blinks eyes” and calls out to the snowwoman.
snowwoman turns around.
The idea now is to translate the
design steps to program instructions.
Translating Design to
Instructions
Some steps in the storyboard can be
written as a single instruction
The snowman turns to face the snowwoman
Other steps are composite actions that
require more than one instruction
The snowman tries to catch the
snowwoman’s attention is two actions
The snowman says “ahem”
The snowman raises and lowers his eyes
Concepts in this first program
Program instructions (methods) may have
arguments
Example: for the move instruction (method),
the arguments we used in this example were
direction
distance
DoTogether and DoInOrder blocks can be
nested one inside the other
Single Instructions: Methods
that act “on” some object
Action Blocks in Alice
Sequential Action Block
Simultaneous Action Block
Testing
An important step in creating a program is to run
it – to be sure it does what you expect it to do.
We recommend that you use an incremental
development process:
write a few (or ONE) line(s) of code and then run it
write a ONE more line and run it
write a few more lines and run it…
This process allows you to find any problems
and fix them as you go along.
Be Impatient! Don’t Wait!
Comments
While Alice instructions are easy to
understand, a particular combination of
the instructions may perform an action
that is not immediately obvious.
Comments are used to document the
code – explain the purpose of a
particular segment of the program to
the human reader.
TO
DO
To Do Immediately
Go to http://csemoodle.ucsd.edu and do all items
under Week 1:
Read Logistics
Get Seat Assignment
Do Getting to Know You Survey (20 min)
Do Appendix A (in lab or on own)
Everyone in B270 is a CSE3 student or tutor
TUTORS: in Lab some hours Mon-Wed
Read Chapter 1 and 2 and do the homework
There’s a homework (small) due before
each lecture
Homework has you reading the textbook
and “playing” around with Alice
You don’t turn it in, you answer some questions
at the beginning of next class (with your clicker)
Download