8/27/2012 1
Welcome to CS120 Fall 2012
1
John Magee (jmagee@clarku.edu)
Welcome to CS120
Computing is ubiquitous
Welcome to CS120 Fall 2012 John Magee (jmagee@clarku.edu) 1 - - PDF document
8/27/2012 Welcome to CS120 Fall 2012 John Magee (jmagee@clarku.edu) 1 Welcome to CS120 Computing is ubiquitous Daily life, news, eCommerce Sciences and engineering fields Social sciences, humanity, Arts, music, sports
8/27/2012 1
1
Computing is ubiquitous
8/27/2012 2
One core objective of computing is efficient problem solving Computing shares common methodologies with other fields
Given a problem, how to
– Understand it, formulate it, make hypotheses…
– Design a solution
– Implement a solution
– Test a solution – Revise, improve…
Object-oriented programming Graphics/animation-based problems Alice: A 3D animation language Java: an Eventful Approach Main topics – Methods – Variables and functions – Control structures – Lists and Arrays – Events – Classes
8/27/2012 3
5
6
8/27/2012 4
Pre-requisites This is a first course in computer science. There are no formal pre-requisites. Some informal pre-req’s: – using email, browsing the web – copying and pasting text – some high-school level algebra
Anyone can be successful at learning programming. Decent results, however, take a lot of time.
7
8 9
8/27/2012 5
9 9
This is not a correspondence course.
Questions and discussion are what makes the class interesting.
10 9
8/27/2012 6
11
12
8/27/2012 7
13
14
8/27/2012 8
15
Replace each character with a number…
Coded Message Example: 13 5 5 20 13 5 1 20 19 20 1 18 2 21 3 11 19 Encoding is about converting data into a coded form. Decoding is about converting from coded to normal form.
16
8/27/2012 9
17
18
8/27/2012 10
Each character is up to 6 dots. Each dot is either on or off.
Invented by Louis Braille (1809-1852).
19
20
8/27/2012 11
21
22
8/27/2012 12
23
24
8/27/2012 13
25
26
8/27/2012 14
27 2
28
8/27/2012 15
29 3
30 3
8/27/2012 16
31
Joseph Jacquard (1801) Jacquard’s Loom, the punched card
32
IBM Archives
8/27/2012 17
33
Log of first computer bug, discovered by Grace Hopper, 1945 A Computer Science Pioneer, she later wrote the first Compiler.
34 3
– Web browsing, email, instant messenger – Play games – Watch movies, organize photos – Word processing, spreadsheets, database
8/27/2012 18
Compute, to the last digit, the value of pi.
35
– Syntax (form) – Semantics (meaning)
– BASIC, C++, Java, Perl, Python
36
8/27/2012 19
Computing hardware performs only a small set of concrete operations, which are created in circuitry:
load the number from memory location 2001 into the CPU load the number from memory location 2002 into the CPU add the two numbers in the CPU store the result into location 2003
These instructions must be provided to the CPU as binary notation (1s and 0s), called machine language
37
38
8/27/2012 20
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)
Two kinds of animations:
– Movie: passive user watches the animation – Interactive: active user clicks on mouse, types a key
Alice software is freely distributed Downloading Alice
– Go to the website: http://www.alice.org – Click the link Get Alice 2.2 – Click download link specific to your operating system – Save Alice.zip (or Alice.dmg) to your PC
Installing and running Alice
– Extract Alice from Alice.zip (or Alice.dmg) file – Create desktop shortcut (alias) to Alice.exe – Double-click Alice icon to launch Alice application
41
8/27/2012 21
Go through the tutorials to learn the basics of Alice
42
Drag-and-drop based programming
– Statement resusable within a method (but not statements) – Clipboards available for copying and pasting statements between methods of a class (but not all statements) – Saving a object (with newly defined methods) as a class for using in other worlds
8/27/2012 22
Contain
– Basic description of what happens when program runs – Nouns in story (Alice, the White Rabbit) correspond to
– Verbs correspond to actions, responses to messages – Chronological flow describes the sequence of the actions
When the program begins, Alice and the White Rabbit are facing each other, Alice on the left and the White Rabbit on the right. Alice turns her head and then greets us. The White Rabbit also turns and then greets us. Alice and the White Rabbit introduce
“Welcome to our world.”
Alice in Action with Java 44
A numbered sequence of objects and actions
“Welcome to our world.”
Alice in Action with Java 45
8/27/2012 23
For a given user story
Alice in Action with Java 46
Eventful Java (tentative)
8/27/2012 24
48
– Visit the course web page – Download Alice 2.2
– Readings:
49