19
http://cs.harvard.edu/mal an/scratch/index.php Communicating via Programming Languages Palmyra Area High School 1

Http://cs.harvard.edu/malan/scratch/ index.php Palmyra Area High School 1

Embed Size (px)

Citation preview

1

http://cs.harvard.edu/malan/scratch/index.php

Communicating via Programming Languages

Palmyra Area High School

2

Why Teach Programming?

• Some folks believe that every student should learn to program– Computational thinking is an essential capability

for just about everyone. – Programming is an incredibly useful skill: fields

from anthropology to zoology students who code will have an advantage over those who can’t.

– It is predicted that 71 percent of all new jobs in STEM fields during the next decade will be in computer science.

3

What I Find True About Coding

• It teaches students about logic and patterns

• Empowers some, frustrates others• It takes some time to really develop this

beyond simplicity• Scratch is written for simplicity but can

become as complex as needed

4

What is Programming/Coding?

• The ability to talk to a computer in a language it can understand

• The computer will read your programming code and execute your instructions

• The code must be correct and unambiguous

5

6

Python- Example

7

Programming Languages

Why do we have programming languages? A way of thinking

A way of effectively expressing instructions

What is a language for?Tell the hardware what you want it to do

Not necessary to make physical hardware changes

8

Programming in Scratch

• Visual based programing • Commands are in the form of pieces• Pieces are then linked together sort of like Legos• Simplifies programming less intensive on learning the

language and more on the application• Based off of Python• Should be used to introduce the idea of coding

elementary & middle school• HS should move into actual programming languages –

but we are not there yet!• It can be used to develop apps for Android OS

9

Programming Terminology

• Statements

• Boolean Expression

• Conditions

• Loops

• Variables

• Threads

• Events

• Sprite

10

Scratch Cat – Sprite

2D image or animation

Costume 1 Costume 2 Costume 3 Costume 4

Animated Sprite

11

Statements

• Tell the computer what to do

• It is an instruction to follow

SCRATCH EXAMPLE:

12

Boolean Expression

• An expression that is either TRUE or FALSE

SCRATCH EXAMPLE:

With Boolean expressions we can create conditions!

PYTHONBoolean = bool(input( “Enter a Boolean Value: “))

13

Conditions

• Must be TRUE to occur

• If, When & Until are condition labels

SCRATCH EXAMPLE:

If Construct

14

Conditions Cont.

If- Else Construct

PYTHON

Value = input (“Press a Key”)

If value == SPACE: Print “Hello!”Else: Print “Goodbye!”

15

Loops

• A loop executes multiple statements

SCRATCH EXAMPLE:

16

Variables

• A changeable value recorded in memory

• Used whenever a value must be stored

SCRATCH EXAMPLE:

17

Threads• A mini-program within a program

• You can have multiple threads in your program

SCRATCH EXAMPLE:

It is helpful to use separate threads for conceptually distinct tasks

18

Events• Threads and sprites can communicate through

the use of EVENTS

SCRATCH EXAMPLE:

19

Today’s Assignments

• Interactive Virtual Card

• If time create a video game – Probably not, but maybe a simple game!