SlideShare a Scribd company logo
Teaching Programming Online
pamela fox
@pamelafox

Friday, October 18, 13
Friday, October 18, 13
What is Khan Academy?

Friday, October 18, 13
K-12 Subject Tutorials

Friday, October 18, 13
Exercises & Videos

Friday, October 18, 13
Personalized Learning

Friday, October 18, 13
Teacher-facing Analytics

Friday, October 18, 13
The Tech Stack
Backend

Frontend

Handlebars
jQuery
Backbone

Friday, October 18, 13

LESS

FB React
Heavy on Open Source
Using

Contributing

Blogging
http://bjk5.com/
http://mattfaus.com/
Friday, October 18, 13

https://github.com/Khan
Friday, October 18, 13
What should we teach, exactly?

Friday, October 18, 13
So many options
Ruby C++
Haskell
Scheme
Java Python Lua
JavaScript

Languages

Websites Mobile
Games Hardware
Animation

Uses

Robotics Simulation
Data Science
Friday, October 18, 13
Our goals
No Installation Needed
Fun for Anyone
Shareable
Gateway Drug

Friday, October 18, 13
So many options
Ruby C++
Haskell
Scheme
Java Python Lua
JavaScript

Languages

Websites Mobile
Games Hardware
Animation
Robotics Simulation
Data Science

Uses

Friday, October 18, 13
How do students program?

Friday, October 18, 13
ACE editor

ProcessingJS
JSHint ! BabyHint ! Loop Checker

Friday, October 18, 13
ACE Editor
number scrubber

Friday, October 18, 13

color picker
ACE Editor
number scrubber

Friday, October 18, 13

color picker
ACE Editor
number scrubber

Friday, October 18, 13

color picker
ProcessingJS

http://processingjs.org/reference

Friday, October 18, 13
JSHint
var myName = “spaghetti
errors

if (i == 0) {
warnings
}

best
practices

var i = 2;
if (i == 0) {
}

Friday, October 18, 13
BabyHint
elipse(10, 10, 20, 30);
spelling

ellipse(1, 1, 20, 30, 5);
wrong
arguments

Friday, October 18, 13
Infinite Loop Checker
var i = 0;
while(i < 10) {
ellipse(i, i, 30, 30);
}

Web Worker

Friday, October 18, 13
Now, how do we teach?

Friday, October 18, 13
Usual way to teach: Videos

https://www.khanacademy.org/science/computer-science/v/python-lists

Friday, October 18, 13
Our approach: “talk-throughs”
Making passive instruction interactive!

Uses same environment they program in
https://www.khanacademy.org/cs/programming/drawing-basics/p/intro-to-drawing
Friday, October 18, 13
Playing talk-throughs
commands = [
{"key": "n", "time": 14124},
{"key": "n", "time": 14260},
{"key": "r", "time": 14676},
{"key": "e", "time": 14764},
{"key": "c", "time": 15036},
{"key": "t", "time": 15548},...]

SoundManager2.js
var player = soundManager.createSound({
url: revision.getMp3Url(),
whileplaying: function() {
updateTimeLeft(Record.currentTime());
Record.trigger("playUpdate");
}
});

Friday, October 18, 13

<audio> or <object>
Creating talk-throughs

canvas controls

recording controls

Friday, October 18, 13
Recording audio
getUserMedia()
var multirecorder = new MultiRecorder();
multirecorder.startRecording();

new Worker()
rightBuffer.push(stream[0]);
leftBuffer.push(stream[1]);

multirecorder.stopRecording();

getInterleaved();
encodeWAV();

https://github.com/Khan/MultiRecorderJS/blob/master/multirecorder.js

Friday, October 18, 13
How can we assess learning?

Friday, October 18, 13
Usual way to assess: Exercises

Repeated multiple times with variants
Friday, October 18, 13
Our approach: coding challenges

Structured yet flexible.
More than one way to code the solution.
Friday, October 18, 13
...and they’re fun!

Friday, October 18, 13
How do we “grade” challenges?

staticTest

Friday, October 18, 13

StructuredJS

Esprima
Esprima
AST
JavaScript
var theNumber = 50;
if (theNumber > 0) {
}

http://esprima.org/demo/parse.html#
Friday, October 18, 13
StructuredJS
structure:

user code:

var $numVar = $numVal;

var theNumber = 10;

if ($numVar > 0) {
rect($x, $y, $w, $h);
}

fill(255, 255, 255);
if (theNumber > 0) {
rect(10, 10, 30, 40);
}
if (theNumber < 0) {
rect(10, 50, 30, 40);
}

it’s a match!
http://khan.github.io/structuredjs/index.html

Friday, October 18, 13
staticTest
staticTest(“Add the ifs!”, function() {
var descrip = “Now add an if to check if the number is positive.”;
var pattern = function() {
var $numVar = $numVal;
if ($numVar > 0) {
rect($x, $y, $w, $h);
}
};
result = match(pattern);
if (passes(result)) {
var goodX = structure(pattern, inRange(“$x”, 10, 20));
if (!matches(goodX)) {
result = fail(“Hm, does your rect start on the side?”);
}
}
assertMatch(result, descrip, displayP);
});

Friday, October 18, 13
...Not quite that simple, though!

Most challenge tests are hundreds of lines long.

Most steps have 10-20 helpful messages.

https://www.khanacademy.org/cs/challenge-exploding-sun/2050946856

Friday, October 18, 13
How do we get feedback on challenges?

<form action=”https://docs.google.com/a/khanacademy.org/forms/
d/1OmFRH5NoBusswiSaSYkoDiUPayycXLnpQh8IX60tJbM/formResponse”
method="post" target="hidden_iframe">

Friday, October 18, 13
Spreadsheet of user feedback
pivot table!

Friday, October 18, 13
...plus automated statistics

Friday, October 18, 13
How can we create a community?

Friday, October 18, 13
Questions & Answers

Friday, October 18, 13
Wilson Voting Algorithm, GAE’d
def wilson_confidence(upvotes_name, downvotes_name, score):
"""Lower bound of Wilson score 90% confidence interval.
This is the algorithm Reddit uses to sort comments.
You should not use this if downvotes are disallowed - it is only useful in
the presence of both upvotes and downvotes because its ranking is based on
an estimate of the ratio of upvotes to downvotes.
See http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
"""
upvotes = getattr(score, upvotes_name)
downvotes = getattr(score, downvotes_name)
if upvotes == 0:
return -downvotes
elif upvotes == downvotes:
return 0
n = upvotes + downvotes
z = 1.64485 # 90% confidence z-score
phat = float(upvotes) / n # p-hat
return ((phat + z * z / (2 * n) - z *
math.sqrt((phat * (1 - phat) + z * z / (4 * n)) / n))
/ (1 + z * z / n))

class TimeIndependentScoreProperty(ndb.ComputedProperty):
def __init__(self, upvotes_name="upvotes", downvotes_name="downvotes",
**kwargs):
super(TimeIndependentScoreProperty, self).__init__(
functools.partial(wilson_confidence, upvotes_name, downvotes_name),
**kwargs)

Friday, October 18, 13
Spin-offs!

Friday, October 18, 13
The Hot Programs

Friday, October 18, 13
Reddit Voting Algorithm, GAE’d
def time_dependent(decay_seconds, upvotes_name, downvotes_name, created_name, score):
"""Ranking based on both age and quality.
This is the algorithm Reddit uses to sort stories. We want there to be
churn, a constant stream of new programs hitting the hot page,
so this algorithm takes into account both the score of the scratchpad and the age.
See http://amix.dk/blog/post/19588
"""
s = getattr(score, upvotes_name) - getattr(score, downvotes_name)
# Weight votes logarithmically - initial votes are worth a ton
order = math.log(max(abs(s), 1), 10)
sign = 1 if s > 0 else -1 if s < 0 else 0
# Seconds since this algorithm's start date
date = getattr(score, created_name) or datetime.datetime.now()
seconds = epoch_seconds(date) - 1349108492
return round(order + sign * seconds / decay_seconds, 7)

class TimeDependentScoreProperty(ndb.ComputedProperty):
def __init__(self, decay_seconds, upvotes_name="upvotes",
downvotes_name="downvotes", created_name="created", **kwargs):
super(TimeDependentScoreProperty, self).__init__(functools.partial(
time_dependent, decay_seconds, upvotes_name, downvotes_name,
created_name), **kwargs)

Friday, October 18, 13
Teaching Programming Online

Learn

Friday, October 18, 13

Practice

Create

Share

Help

More Related Content

What's hot (18)

PPT
Web Scraper Shibuya.pm tech talk #8
Tatsuhiko Miyagawa
 
PDF
Clojure: Simple By Design
All Things Open
 
PDF
Yahoo is open to developers
Christian Heilmann
 
PDF
Black Ops Testing Workshop from Agile Testing Days 2014
Alan Richardson
 
PDF
Effective Benchmarks
Workhorse Computing
 
PDF
Code with style
Clayton Parker
 
PDF
Code with Style - PyOhio
Clayton Parker
 
PPT
Shibuyajs Digest
takesako
 
PDF
Getting testy with Perl
Workhorse Computing
 
PDF
Unit Testing Lots of Perl
Workhorse Computing
 
PDF
실시간 웹 협업도구 만들기 V0.3
NAVER D2
 
PDF
Getting Testy With Perl6
Workhorse Computing
 
PDF
A Modest Introduction To Swift
John Anderson
 
PPTX
Javascript - The Stack and Beyond
All Things Open
 
PPT
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
 
PPT
SXSW 2012 JavaScript MythBusters
Elena-Oana Tabaranu
 
PPT
Intro to jQuery
Ralph Whitbeck
 
PDF
Abstraction Layers Test Management Summit Faciliated Session 2014
Alan Richardson
 
Web Scraper Shibuya.pm tech talk #8
Tatsuhiko Miyagawa
 
Clojure: Simple By Design
All Things Open
 
Yahoo is open to developers
Christian Heilmann
 
Black Ops Testing Workshop from Agile Testing Days 2014
Alan Richardson
 
Effective Benchmarks
Workhorse Computing
 
Code with style
Clayton Parker
 
Code with Style - PyOhio
Clayton Parker
 
Shibuyajs Digest
takesako
 
Getting testy with Perl
Workhorse Computing
 
Unit Testing Lots of Perl
Workhorse Computing
 
실시간 웹 협업도구 만들기 V0.3
NAVER D2
 
Getting Testy With Perl6
Workhorse Computing
 
A Modest Introduction To Swift
John Anderson
 
Javascript - The Stack and Beyond
All Things Open
 
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
 
SXSW 2012 JavaScript MythBusters
Elena-Oana Tabaranu
 
Intro to jQuery
Ralph Whitbeck
 
Abstraction Layers Test Management Summit Faciliated Session 2014
Alan Richardson
 

Viewers also liked (15)

KEY
Django Admin: Widgetry & Witchery
Pamela Fox
 
PDF
A Year of Hermit Hacking
Pamela Fox
 
PDF
Engineering culture
Pamela Fox
 
PDF
The Developer Experience
Pamela Fox
 
PDF
Présentation RIA avec Adobe Flex / RIA with Adobe Flex
Cynapsys It Hotspot
 
PPT
El Estado es un obstaculo
Alicia Vasquez
 
PPT
LOR Characteristics and Considerations
Scott Leslie
 
PPT
Sizzling Stylus!
Pamela Fox
 
PPT
OpenSocial Intro
Pamela Fox
 
PPT
Por Qué Fracasa el Estado en la Educación
Alicia Vasquez
 
PPT
¿HAY LIBERTAD ECONOMICA?
Alicia Vasquez
 
PPT
Flex vs. HTML5 for RIAS
Pamela Fox
 
PPT
Client Killed the Server Star
Pamela Fox
 
PPT
No, Really, I'm Shy
Pamela Fox
 
PPT
LA EDUCACIÓN EN UNA ECONOMIA LIBRE
Alicia Vasquez
 
Django Admin: Widgetry & Witchery
Pamela Fox
 
A Year of Hermit Hacking
Pamela Fox
 
Engineering culture
Pamela Fox
 
The Developer Experience
Pamela Fox
 
Présentation RIA avec Adobe Flex / RIA with Adobe Flex
Cynapsys It Hotspot
 
El Estado es un obstaculo
Alicia Vasquez
 
LOR Characteristics and Considerations
Scott Leslie
 
Sizzling Stylus!
Pamela Fox
 
OpenSocial Intro
Pamela Fox
 
Por Qué Fracasa el Estado en la Educación
Alicia Vasquez
 
¿HAY LIBERTAD ECONOMICA?
Alicia Vasquez
 
Flex vs. HTML5 for RIAS
Pamela Fox
 
Client Killed the Server Star
Pamela Fox
 
No, Really, I'm Shy
Pamela Fox
 
LA EDUCACIÓN EN UNA ECONOMIA LIBRE
Alicia Vasquez
 
Ad

Similar to Teaching Programming Online (20)

PDF
From programming to software engineering: ICSE keynote slides available
Celso Martins
 
PDF
Advance data structure & algorithm
K Hari Shankar
 
PPT
2 programming-using-java how to built application
Mahmoud Alfarra
 
PDF
Teacher toolkit Pycon UK Sept 2018
Sue Sentance
 
PDF
Basic concepts of algorithms edukite
EduKite
 
PPTX
Introduction to data structures and its types
sonalishinge2015
 
PPTX
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
PDF
Lec01-Algorithems - Introduction and Overview.pdf
MAJDABDALLAH3
 
PPTX
Data Structure and Algorithms
iqbalphy1
 
PDF
Approaches to teaching primary computing
JEcomputing
 
PPT
Data Structures- Part1 overview and review
Abdullah Al-hazmy
 
PDF
2 coding101 fewd_lesson2_programming_overview 20210105
John Picasso
 
PPTX
Lect1.pptx
muhammadRamzan816406
 
PPT
Intro to DSAA.ppt
jumar dimas
 
PPTX
Google Farewell Competition.pptx
harrishadjiantonis1
 
PPTX
Class[1][23ed may] [algorithms]
Saajid Akram
 
PDF
Christian Gill ''Functional programming for the people''
OdessaJS Conf
 
PDF
Bootcamp - Team TEAL - Day 5
Liz Rutledge
 
From programming to software engineering: ICSE keynote slides available
Celso Martins
 
Advance data structure & algorithm
K Hari Shankar
 
2 programming-using-java how to built application
Mahmoud Alfarra
 
Teacher toolkit Pycon UK Sept 2018
Sue Sentance
 
Basic concepts of algorithms edukite
EduKite
 
Introduction to data structures and its types
sonalishinge2015
 
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Lec01-Algorithems - Introduction and Overview.pdf
MAJDABDALLAH3
 
Data Structure and Algorithms
iqbalphy1
 
Approaches to teaching primary computing
JEcomputing
 
Data Structures- Part1 overview and review
Abdullah Al-hazmy
 
2 coding101 fewd_lesson2_programming_overview 20210105
John Picasso
 
Intro to DSAA.ppt
jumar dimas
 
Google Farewell Competition.pptx
harrishadjiantonis1
 
Class[1][23ed may] [algorithms]
Saajid Akram
 
Christian Gill ''Functional programming for the people''
OdessaJS Conf
 
Bootcamp - Team TEAL - Day 5
Liz Rutledge
 
Ad

More from Pamela Fox (20)

PPT
How I became a born again vegetable-tarian
Pamela Fox
 
KEY
The Developer Experience
Pamela Fox
 
PPT
Writing Apps the Google-y Way (Brisbane)
Pamela Fox
 
PPT
Writing Apps the Google-y Way
Pamela Fox
 
PPT
The Wonders of the "Onesie"
Pamela Fox
 
PPT
I’M A Barbie Girl In A CS World
Pamela Fox
 
PPT
Google Wave 20/20: Product, Protocol, Platform
Pamela Fox
 
PPT
Collaborative Mapping with Google Wave
Pamela Fox
 
PPT
Google Products: Deep Dive on Google Maps
Pamela Fox
 
PPT
Google Products & Google Maps
Pamela Fox
 
PPT
Mashups & APIs
Pamela Fox
 
PPT
A World of Words
Pamela Fox
 
PPT
Web APIs & Google APIs
Pamela Fox
 
PPT
Growing up Geek: My Dad, the Computer Scientist
Pamela Fox
 
PPT
Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure
Pamela Fox
 
PPT
NORAD Santa Tracker: Tips & Tricks
Pamela Fox
 
PPT
Socializing Apps
Pamela Fox
 
PPT
Open Maps (Or Close Enough?)
Pamela Fox
 
PPT
Gadgets Intro (Plus Mapplets)
Pamela Fox
 
PPT
Data-Driven Facial Animation Based on Feature Points
Pamela Fox
 
How I became a born again vegetable-tarian
Pamela Fox
 
The Developer Experience
Pamela Fox
 
Writing Apps the Google-y Way (Brisbane)
Pamela Fox
 
Writing Apps the Google-y Way
Pamela Fox
 
The Wonders of the "Onesie"
Pamela Fox
 
I’M A Barbie Girl In A CS World
Pamela Fox
 
Google Wave 20/20: Product, Protocol, Platform
Pamela Fox
 
Collaborative Mapping with Google Wave
Pamela Fox
 
Google Products: Deep Dive on Google Maps
Pamela Fox
 
Google Products & Google Maps
Pamela Fox
 
Mashups & APIs
Pamela Fox
 
A World of Words
Pamela Fox
 
Web APIs & Google APIs
Pamela Fox
 
Growing up Geek: My Dad, the Computer Scientist
Pamela Fox
 
Living in the Cloud: Hosting Data & Apps Using the Google Infrastructure
Pamela Fox
 
NORAD Santa Tracker: Tips & Tricks
Pamela Fox
 
Socializing Apps
Pamela Fox
 
Open Maps (Or Close Enough?)
Pamela Fox
 
Gadgets Intro (Plus Mapplets)
Pamela Fox
 
Data-Driven Facial Animation Based on Feature Points
Pamela Fox
 

Recently uploaded (20)

PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Digital Circuits, important subject in CS
contactparinay1
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 

Teaching Programming Online

  • 1. Teaching Programming Online pamela fox @pamelafox Friday, October 18, 13
  • 3. What is Khan Academy? Friday, October 18, 13
  • 5. Exercises & Videos Friday, October 18, 13
  • 9. Heavy on Open Source Using Contributing Blogging http://bjk5.com/ http://mattfaus.com/ Friday, October 18, 13 https://github.com/Khan
  • 11. What should we teach, exactly? Friday, October 18, 13
  • 12. So many options Ruby C++ Haskell Scheme Java Python Lua JavaScript Languages Websites Mobile Games Hardware Animation Uses Robotics Simulation Data Science Friday, October 18, 13
  • 13. Our goals No Installation Needed Fun for Anyone Shareable Gateway Drug Friday, October 18, 13
  • 14. So many options Ruby C++ Haskell Scheme Java Python Lua JavaScript Languages Websites Mobile Games Hardware Animation Robotics Simulation Data Science Uses Friday, October 18, 13
  • 15. How do students program? Friday, October 18, 13
  • 16. ACE editor ProcessingJS JSHint ! BabyHint ! Loop Checker Friday, October 18, 13
  • 17. ACE Editor number scrubber Friday, October 18, 13 color picker
  • 18. ACE Editor number scrubber Friday, October 18, 13 color picker
  • 19. ACE Editor number scrubber Friday, October 18, 13 color picker
  • 21. JSHint var myName = “spaghetti errors if (i == 0) { warnings } best practices var i = 2; if (i == 0) { } Friday, October 18, 13
  • 22. BabyHint elipse(10, 10, 20, 30); spelling ellipse(1, 1, 20, 30, 5); wrong arguments Friday, October 18, 13
  • 23. Infinite Loop Checker var i = 0; while(i < 10) { ellipse(i, i, 30, 30); } Web Worker Friday, October 18, 13
  • 24. Now, how do we teach? Friday, October 18, 13
  • 25. Usual way to teach: Videos https://www.khanacademy.org/science/computer-science/v/python-lists Friday, October 18, 13
  • 26. Our approach: “talk-throughs” Making passive instruction interactive! Uses same environment they program in https://www.khanacademy.org/cs/programming/drawing-basics/p/intro-to-drawing Friday, October 18, 13
  • 27. Playing talk-throughs commands = [ {"key": "n", "time": 14124}, {"key": "n", "time": 14260}, {"key": "r", "time": 14676}, {"key": "e", "time": 14764}, {"key": "c", "time": 15036}, {"key": "t", "time": 15548},...] SoundManager2.js var player = soundManager.createSound({ url: revision.getMp3Url(), whileplaying: function() { updateTimeLeft(Record.currentTime()); Record.trigger("playUpdate"); } }); Friday, October 18, 13 <audio> or <object>
  • 28. Creating talk-throughs canvas controls recording controls Friday, October 18, 13
  • 29. Recording audio getUserMedia() var multirecorder = new MultiRecorder(); multirecorder.startRecording(); new Worker() rightBuffer.push(stream[0]); leftBuffer.push(stream[1]); multirecorder.stopRecording(); getInterleaved(); encodeWAV(); https://github.com/Khan/MultiRecorderJS/blob/master/multirecorder.js Friday, October 18, 13
  • 30. How can we assess learning? Friday, October 18, 13
  • 31. Usual way to assess: Exercises Repeated multiple times with variants Friday, October 18, 13
  • 32. Our approach: coding challenges Structured yet flexible. More than one way to code the solution. Friday, October 18, 13
  • 34. How do we “grade” challenges? staticTest Friday, October 18, 13 StructuredJS Esprima
  • 35. Esprima AST JavaScript var theNumber = 50; if (theNumber > 0) { } http://esprima.org/demo/parse.html# Friday, October 18, 13
  • 36. StructuredJS structure: user code: var $numVar = $numVal; var theNumber = 10; if ($numVar > 0) { rect($x, $y, $w, $h); } fill(255, 255, 255); if (theNumber > 0) { rect(10, 10, 30, 40); } if (theNumber < 0) { rect(10, 50, 30, 40); } it’s a match! http://khan.github.io/structuredjs/index.html Friday, October 18, 13
  • 37. staticTest staticTest(“Add the ifs!”, function() { var descrip = “Now add an if to check if the number is positive.”; var pattern = function() { var $numVar = $numVal; if ($numVar > 0) { rect($x, $y, $w, $h); } }; result = match(pattern); if (passes(result)) { var goodX = structure(pattern, inRange(“$x”, 10, 20)); if (!matches(goodX)) { result = fail(“Hm, does your rect start on the side?”); } } assertMatch(result, descrip, displayP); }); Friday, October 18, 13
  • 38. ...Not quite that simple, though! Most challenge tests are hundreds of lines long. Most steps have 10-20 helpful messages. https://www.khanacademy.org/cs/challenge-exploding-sun/2050946856 Friday, October 18, 13
  • 39. How do we get feedback on challenges? <form action=”https://docs.google.com/a/khanacademy.org/forms/ d/1OmFRH5NoBusswiSaSYkoDiUPayycXLnpQh8IX60tJbM/formResponse” method="post" target="hidden_iframe"> Friday, October 18, 13
  • 40. Spreadsheet of user feedback pivot table! Friday, October 18, 13
  • 42. How can we create a community? Friday, October 18, 13
  • 43. Questions & Answers Friday, October 18, 13
  • 44. Wilson Voting Algorithm, GAE’d def wilson_confidence(upvotes_name, downvotes_name, score): """Lower bound of Wilson score 90% confidence interval. This is the algorithm Reddit uses to sort comments. You should not use this if downvotes are disallowed - it is only useful in the presence of both upvotes and downvotes because its ranking is based on an estimate of the ratio of upvotes to downvotes. See http://www.evanmiller.org/how-not-to-sort-by-average-rating.html """ upvotes = getattr(score, upvotes_name) downvotes = getattr(score, downvotes_name) if upvotes == 0: return -downvotes elif upvotes == downvotes: return 0 n = upvotes + downvotes z = 1.64485 # 90% confidence z-score phat = float(upvotes) / n # p-hat return ((phat + z * z / (2 * n) - z * math.sqrt((phat * (1 - phat) + z * z / (4 * n)) / n)) / (1 + z * z / n)) class TimeIndependentScoreProperty(ndb.ComputedProperty): def __init__(self, upvotes_name="upvotes", downvotes_name="downvotes", **kwargs): super(TimeIndependentScoreProperty, self).__init__( functools.partial(wilson_confidence, upvotes_name, downvotes_name), **kwargs) Friday, October 18, 13
  • 46. The Hot Programs Friday, October 18, 13
  • 47. Reddit Voting Algorithm, GAE’d def time_dependent(decay_seconds, upvotes_name, downvotes_name, created_name, score): """Ranking based on both age and quality. This is the algorithm Reddit uses to sort stories. We want there to be churn, a constant stream of new programs hitting the hot page, so this algorithm takes into account both the score of the scratchpad and the age. See http://amix.dk/blog/post/19588 """ s = getattr(score, upvotes_name) - getattr(score, downvotes_name) # Weight votes logarithmically - initial votes are worth a ton order = math.log(max(abs(s), 1), 10) sign = 1 if s > 0 else -1 if s < 0 else 0 # Seconds since this algorithm's start date date = getattr(score, created_name) or datetime.datetime.now() seconds = epoch_seconds(date) - 1349108492 return round(order + sign * seconds / decay_seconds, 7) class TimeDependentScoreProperty(ndb.ComputedProperty): def __init__(self, decay_seconds, upvotes_name="upvotes", downvotes_name="downvotes", created_name="created", **kwargs): super(TimeDependentScoreProperty, self).__init__(functools.partial( time_dependent, decay_seconds, upvotes_name, downvotes_name, created_name), **kwargs) Friday, October 18, 13
  • 48. Teaching Programming Online Learn Friday, October 18, 13 Practice Create Share Help

Editor's Notes