50
Easy as Pie? Teaching Code Literacy Sarah Allen @ultrasaurus

Teaching code literacy

Embed Size (px)

DESCRIPTION

Teaching Code Literacy: slides for a talk at Strange Loop 2011

Citation preview

Page 1: Teaching code literacy

Easy as Pie?Teaching Code Literacy

Sarah Allen@ultrasaurus

Page 2: Teaching code literacy

Coding Literacy

Page 3: Teaching code literacy

Sarah Allen@ultrasaurus

Page 4: Teaching code literacy

Sarah Allen@ultrasaurus

Page 5: Teaching code literacy

Why?Pie: the languageTeaching Kids

Page 6: Teaching code literacy

Why?Pie: the languageTeaching Kids

Page 7: Teaching code literacy

Why?Pie: the language

Learning from Kids

Page 8: Teaching code literacy

Why me?Why teach kids to code?Why create a language?

Why Ruby?

Page 9: Teaching code literacy

IntrinsicGratification

AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!

Page 10: Teaching code literacy

IntrinsicGratification

http://www.flickr.com/photos/bkajino/3055670482/

Page 11: Teaching code literacy

Results

Page 12: Teaching code literacy

Results

Page 14: Teaching code literacy

AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!AWESOME!!!!!!!!!!!!!

Page 15: Teaching code literacy

Why teach kids code?

• Software is part of how our world works

• Skill for thinking & communicating

• Before they start believing they can’t

• By high school some will outpace adults

Page 16: Teaching code literacy
Page 17: Teaching code literacy

language?

Page 18: Teaching code literacy

Small codeBig effectSimple syntax

Page 19: Teaching code literacy

“real” language

Page 20: Teaching code literacy

Domain Specific LanguageDomain = Web Games

http://pie-bakery.heroku.com/

Page 21: Teaching code literacy

Pie: the language

• What is Pie? (demo)

• How do you make Pie? (the code)

Page 22: Teaching code literacy
Page 23: Teaching code literacy
Page 24: Teaching code literacy

place

Page 25: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

Page 26: Teaching code literacy

place(park:"You are in a park...")place(trees:"You are in a Japanese garden.")place(river_edge:"The path ends at a river")place(in_the_river:"You walk into the river and drown.")

Page 27: Teaching code literacy

place(:park => "You are in a park...")place(:trees => "You are in a Japanese garden.")place(:river_edge => "The path ends at a river")place(:in_the_river => "You walk into the river and drown.")

Page 28: Teaching code literacy

place(park:"You are in a park...")place(trees:"You are in a Japanese garden.")place(river_edge:"The path ends at a river")place(in_the_river:"You walk into the river and drown.")

Page 29: Teaching code literacy

だいさんかを いっしょうべんきょうするつもりです

Page 30: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

Page 31: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

park.path trees:north, river_edge:eastriver_edge.path in_the_river:east!

Page 32: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

park.path trees:north, river_edge:eastriver_edge.path in_the_river:east!

Page 33: Teaching code literacy

Metaprogramming

Page 34: Teaching code literacy

Ruby Techniquesused in the Pie DSL

• method_missing

• blocks with instance_eval

Page 35: Teaching code literacy

pie game.pie

File.open(pie_file) do |f|

end

Page 36: Teaching code literacy

pie game.pie

File.open(pie_file) do |f| new_pie.instance_eval do eval(f.read)end

Page 37: Teaching code literacy

place park:"You are...

def place(options) Place.new(places, options)end

Page 38: Teaching code literacy

park.path trees:north

def method_missing(name) ...end

Page 39: Teaching code literacy

park.path trees:north

def method_missing(name) place = places[name] ...

Page 40: Teaching code literacy

park.path trees:north

class Place

def path ...

Page 41: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

park.path trees:north, river_edge:eastriver_edge.path in_the_river:east!

Page 42: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

park.path trees:north, river_edge:eastriver_edge.path in_the_river:east!

Page 43: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

park.path trees:north, river_edge:eastriver_edge.path in_the_river:east!

Page 44: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

park.path trees:north, river_edge:eastriver_edge.path in_the_river:east!

Page 45: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

park.path trees:north, river_edge:eastriver_edge.path in_the_river:east!

Page 46: Teaching code literacy

place park:"You are in a park..."place trees:"You are in a Japanese garden."place river_edge:"The path ends at a river"place in_the_river:"You walk into the river and drown."

park.path trees:north, river_edge:eastriver_edge.path in_the_river:east!trees.path river_edge:"go through the trees"

Page 47: Teaching code literacy

Tech Notes

• Sinatra web apphttp://www.sinatrarb.com/

• Rails IDEhttp://rubyonrails.org/

• Rhodes mobile appshttp://rhomobile.com/

Page 48: Teaching code literacy

What I Learned

• Installation is boring

• Teach Different Thingslanguage, environments, physical computing

• Seek Immediate Gratification

• Errors are part of the user experience

Page 49: Teaching code literacy

Next Steps

• Snazzier games

• Create a path to writing more code

• IDE improvements