How WebHooks Will Make Us All Programmers

120
@progrium #webhooks web developers? how many are frontend, how many are backend? twitter username. send me questions.

description

A talk I gave at SXSW 2010 about WebHooks, the Evented Web, and how it will "make us all programmers."

Transcript of How WebHooks Will Make Us All Programmers

Page 1: How WebHooks Will Make Us All Programmers

@progrium#webhooks

web developers? how many are frontend, how many are backend? twitter username. send me questions.

Page 2: How WebHooks Will Make Us All Programmers

How WebHooks Will Make Us All

Programmers

has kathy sierra taught me nothing?

Page 3: How WebHooks Will Make Us All Programmers

How WebHooks Will Make You A

G O D

alternative title

Page 4: How WebHooks Will Make Us All Programmers

someday you may be asked if you’re a god and as we’ve learned from ghostbusters, you will want to be able to say yes.

Page 5: How WebHooks Will Make Us All Programmers

The Evented Web

How WebHooks Will Make You A

G O D

evented programming

Page 6: How WebHooks Will Make Us All Programmers
Page 7: How WebHooks Will Make Us All Programmers
Page 8: How WebHooks Will Make Us All Programmers
Page 9: How WebHooks Will Make Us All Programmers
Page 10: How WebHooks Will Make Us All Programmers
Page 11: How WebHooks Will Make Us All Programmers
Page 12: How WebHooks Will Make Us All Programmers
Page 13: How WebHooks Will Make Us All Programmers

What are WebHooks?

Why should we all learn to program?

How do WebHooks foster programming?

Page 14: How WebHooks Will Make Us All Programmers

What are WebHooks?

1

event callbacks over the web. the design pattern or architecture of letting users receive notifications over http. it’s not a spec or a protocol, it’s more along the lines of ajax: just an interesting way of doing things.

Page 15: How WebHooks Will Make Us All Programmers

What are WebHooks?

1

event callbacks over the web. the design pattern or architecture of letting users receive notifications over http. it’s not a spec or a protocol, it’s more along the lines of ajax: just an interesting way of doing things.

Page 16: How WebHooks Will Make Us All Programmers

command line: pipes. we talk about the equivalent of pipes on the web and people say RSS! and I say nooo.... it’s something else.

Page 17: How WebHooks Will Make Us All Programmers

Program

Input Output

pipes are amazing in their simplicity. it’s all from a bit of infrastructure involving input and output

Page 18: How WebHooks Will Make Us All Programmers

Program

STDIN STDOUT

STDERR

Program

stdin, stdout were available to reroute wherever the user wantedmost common use was chaining commands together: pipingfeedback loop, which is the key to emergent systems

Page 19: How WebHooks Will Make Us All Programmers

cat

xargs

wc

mailecho

grep

wget

so you had all these simple little programs, that might not even be useful alone

Page 20: How WebHooks Will Make Us All Programmers

cat

xargs

wc

mailecho

grep

wget

string them together...

Page 21: How WebHooks Will Make Us All Programmers

grepcat

xargs

wc

mailecho

wget

Page 22: How WebHooks Will Make Us All Programmers

mailgrepcat

xargs

wc

echowget

and you have something more useful than just the sum of the parts

Page 23: How WebHooks Will Make Us All Programmers

STDIN

Program

but it doesn’t work without the output. it just breaks.

Page 24: How WebHooks Will Make Us All Programmers

Web App

API

unfortunately that’s how the web is today. we can talk to web apps, but they really can’t talk to us. or anything else really.

Page 25: How WebHooks Will Make Us All Programmers

Web App

API Events

it’s not that they can’t, they just don’t. we need to start placing event hooks in.

Page 26: How WebHooks Will Make Us All Programmers

function clickHandler() { alert("Click!");}

element.addEventListener('click', clickHandler);

Page 27: How WebHooks Will Make Us All Programmers

element.addEventListener('click', function() { alert("Click!"); });

Page 28: How WebHooks Will Make Us All Programmers

element.addEventListener('click', function() { var name = $("input#name").val(); if (name != "") { alert("Hello, " + name); }});

Page 29: How WebHooks Will Make Us All Programmers

element.addEventListener('click', function(event) { var name = $("input#name").val(); if (name != "") { alert("Hello, " + name + ". " + "I'm " + event.target.id); }});

Page 30: How WebHooks Will Make Us All Programmers

getting people excited about evented programming.twisted, event machine, etc ... event driven programming.web hooks -> evented web

Page 31: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', function(event) { var twitterUser = event.follower; var friends = facebook.getFriendsNames();

if (twitterUser['name'] in friends) { twitter.follow(twitterUser); }})

Page 32: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', function(event) { var twitterUser = event.follower; var friends = facebook.getFriendsNames();

if (twitterUser['name'] in friends) { twitter.follow(twitterUser); }})

Page 33: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', function(event) { var twitterUser = event.follower; var friends = facebook.getFriendsNames();

if (twitterUser['name'] in friends) { twitter.follow(twitterUser); }})

Page 34: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', function(event) { var twitterUser = event.follower; var friends = facebook.getFriendsNames();

if (twitterUser['name'] in friends) { twitter.follow(twitterUser); }})

Page 35: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', function(event) { var twitterUser = event.follower; var friends = facebook.getFriendsNames();

if (twitterUser['name'] in friends) { twitter.follow(twitterUser); } else if (twitterUser['following'] > 1000 && twitterUser['followers'] < twitterUser['following'] / 2) { twitter.block(twitterUser); }})

Page 36: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', v eventHandler);

Page 37: How WebHooks Will Make Us All Programmers

twitter.addWebHook('newfollower', 'http://example.com/eventhandler');

Page 38: How WebHooks Will Make Us All Programmers

twitter.addWebHook('friendupdate', 'http://example.com/eventhandler');

some other events you could imagine writing handlers for

Page 39: How WebHooks Will Make Us All Programmers

twitter.addWebHook('directmessage', 'http://example.com/eventhandler');

Page 40: How WebHooks Will Make Us All Programmers

twitter.addWebHook('myupdate', 'http://example.com/eventhandler');

makes twitter an even more powerful platform than it is

Page 41: How WebHooks Will Make Us All Programmers

MAILHOOKS DEMO

let’s see this in action. mailhooks was one of the first “adapters” i built for the evented web.

Page 42: How WebHooks Will Make Us All Programmers
Page 43: How WebHooks Will Make Us All Programmers

MORE DEMOS(and then code)

create postbin, setup/show tender, pivotal tracker, twilio.demo clickhooks with postbin and and then show the code.http://2.latest.scriptletsapp.appspot.com/1w47Cs/run

Page 44: How WebHooks Will Make Us All Programmers

webhooks are simple as you saw. their simplicity affords them to be used as a simple building block in slightly more complex systems like pubsubhubbub.how many have heard of pubsubhubbub? how many know what it does?

Page 45: How WebHooks Will Make Us All Programmers

not time to play the video, i know brett is here and they talked about it.basically real-time feeds using webhooks as the core mechanic.

Page 46: How WebHooks Will Make Us All Programmers

not time to play the video, i know brett is here and they talked about it.basically real-time feeds using webhooks as the core mechanic.

Page 47: How WebHooks Will Make Us All Programmers

all these sites publish content with pubsubhubbub, meaning they all effectively have webhooks for new content events... as a result, you can consume their content in realtime.

Page 48: How WebHooks Will Make Us All Programmers

simple mechanics, if done right, yield rich, emergent dynamics.the emergent system with webhooks is the evented web.

Page 49: How WebHooks Will Make Us All Programmers

Event Triggers

Web APIs Handler Scripts

The Evented Web(Programmable Web 2.0)

(WebHooks)

Page 50: How WebHooks Will Make Us All Programmers

“In computer programming, hooking is a technique used to alter or augment the behavior of [a program], often without having access to its source code.”

Page 51: How WebHooks Will Make Us All Programmers
Page 52: How WebHooks Will Make Us All Programmers
Page 53: How WebHooks Will Make Us All Programmers

Event Triggers

Web APIs Handler Scripts

The Evented Web(Programmable Web 2.0)

(WebHooks)

Page 54: How WebHooks Will Make Us All Programmers

twitter.addWebHook('newfollower', 'http://example.com/eventhandler');

the idea is the handler is a URL... whatever. it doesn’t matter whats on the other end.

Page 55: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', function(event) { var twitterUser = event.follower; var friends = facebook.getFriendsNames();

if (twitterUser['name'] in friends) { twitter.follow(twitterUser); } else if (twitterUser['following'] > 1000 && twitterUser['followers'] < twitterUser['following'] / 2) { twitter.block(twitterUser); }})

Page 56: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', function(event) { var twitterUser = event.follower; var friends = facebook.getFriendsNames();

if (twitterUser['name'] in friends) { twitter.follow(twitterUser); } else if (twitterUser['following'] > 1000 && twitterUser['followers'] < twitterUser['following'] / 2) { twitter.block(twitterUser); }})

Page 57: How WebHooks Will Make Us All Programmers

twitter.addWebHook('newfollower', 'http://example.com/eventhandler');

because its a url, because it’s http ... you already know how to define it. it’s a simple web app, or web script.

Page 58: How WebHooks Will Make Us All Programmers

love it, hate it... its everywhere. commodity hosting. compared to classical cgi and perl, it was easy. no permissions or cgi-bins... just upload a file with ftp.

Page 59: How WebHooks Will Make Us All Programmers

love it, hate it... its everywhere. commodity hosting. compared to classical cgi and perl, it was easy. no permissions or cgi-bins... just upload a file with ftp.

Page 60: How WebHooks Will Make Us All Programmers

love it, hate it... its everywhere. commodity hosting. compared to classical cgi and perl, it was easy. no permissions or cgi-bins... just upload a file with ftp.

Page 61: How WebHooks Will Make Us All Programmers
Page 62: How WebHooks Will Make Us All Programmers

so i built scriptlets, which is basically that. use php, python, javascript to write simple little scripts hosted in the cloud. write it, save it, get a url to run it. perfect for webhook handler scripts.

Page 63: How WebHooks Will Make Us All Programmers

here’s a wrapper that makes postbin work for pubsubhubbub

Page 64: How WebHooks Will Make Us All Programmers

here’s a script used with hookpress to add comment notifications via notify.io to wordpress

Page 65: How WebHooks Will Make Us All Programmers

this is the code i used for the clickhooks demo. you can see how simple it is, notify.io does most of the work.

Page 66: How WebHooks Will Make Us All Programmers

notify.io is a useful part of the ecosystem. it solves the notification part. “how do you get events to the desktop?” pubsubhubbub for examplealso a gateway drug for webhooks...

Page 67: How WebHooks Will Make Us All Programmers

NOTIFY.IO DEMO

intro. twitter DM example. outlets. curl. NioCallback. DrEval...

Page 68: How WebHooks Will Make Us All Programmers

What are WebHooks?

The Evented Web blends our existing ecosystem of web APIs with event-driven programming, creating a web that is both more programmable and real-time.

Page 69: How WebHooks Will Make Us All Programmers

What are WebHooks?

Event callbacks over HTTPenabling the Evented Web

The Evented Web blends our existing ecosystem of web APIs with event-driven programming, creating a web that is both more programmable and real-time.

Page 70: How WebHooks Will Make Us All Programmers

And so concludes the technical portion of the talk.

Questions so far?

Page 71: How WebHooks Will Make Us All Programmers

Why should we all learn to program?

2

so many passionate programmers that are so smart and influential on society. gates, jobs, zuckerberg...exploration of thoughts on significance.sidenote: programming == holistic programming, not just “software engineering”

Page 72: How WebHooks Will Make Us All Programmers

“ As programming becomes more important, it will leave the back room and become a key skill and attribute of our top intellectual and social classes, just as reading and writing did in the past.”

—Marc Prensky

programming is the new literacy. (rushkoff’s talk)i wanted to explore this idea further ...

Page 73: How WebHooks Will Make Us All Programmers

technology.

Page 74: How WebHooks Will Make Us All Programmers

Technology ==

Tools

anything useful created by the mind

Page 75: How WebHooks Will Make Us All Programmers

think of a world without technology.humans might not survive denied technology.some might argue our evolution from prehuman to human was about fully leveraging/developing our ability to create and work with technology

Page 76: How WebHooks Will Make Us All Programmers
Page 77: How WebHooks Will Make Us All Programmers

we drove many major species into extinction and become the dominant species on earth... all with just a little bit of basic technology.

Page 78: How WebHooks Will Make Us All Programmers

The most powerful force in the world.

kevin kelly concludes (among other things) that technology is the most powerful force int he world.

Page 79: How WebHooks Will Make Us All Programmers

pow•er |ˈpou(-ə)r| capacity to cause change

best definition of power. simple. more useful.

Page 80: How WebHooks Will Make Us All Programmers

i like to say that a kid with a laptop can change the world. what is it about the computer?

Page 81: How WebHooks Will Make Us All Programmers
Page 82: How WebHooks Will Make Us All Programmers
Page 83: How WebHooks Will Make Us All Programmers

“The most remarkable tool we’ve ever come up with.”

—Steve Jobs

why?

Page 84: How WebHooks Will Make Us All Programmers

Imagination Compiler

Computing is the ultimate sandbox for our mind, allowing us to explore, model and even execute whatever systems we can *imagine*, as long as we can figure out how to express them. This is programming.

Page 85: How WebHooks Will Make Us All Programmers

don’t have time for this video, but it’s the introduction to the MIT course Structure and Interpretation of computer programs. Abelson goes over how computer science isn’t really a science, maybe more engineering or art... he relates it to magic. he also says it’s not about the computer. it’s fundamentally about formalizing intuitions about process. how to do things.

Page 86: How WebHooks Will Make Us All Programmers

don’t have time for this video, but it’s the introduction to the MIT course Structure and Interpretation of computer programs. Abelson goes over how computer science isn’t really a science, maybe more engineering or art... he relates it to magic. he also says it’s not about the computer. it’s fundamentally about formalizing intuitions about process. how to do things.

Page 87: How WebHooks Will Make Us All Programmers

Process?

intuitions about ... process?

Page 88: How WebHooks Will Make Us All Programmers

Knowledge

well it turns out, process is the basis of knowledge. i could go on quite a while about knowledge, but to keep things on track, we’ll simplify it to this:knowledge is basically a collection of validated models, allowing us to know how to do things. how-to is process.

Page 89: How WebHooks Will Make Us All Programmers

Knowledge==

Power

this now trite idea, first expressed by francis bacon... is something i had to revisit when i defined power as the capacity to cause change. because when framed like this it’s obviously more than a nice correlation: knowledge really *is* the capacity to cause change, therefore in some way, they actually are quite synonymous.

Page 90: How WebHooks Will Make Us All Programmers

Knowledge==

Power

this now trite idea, first expressed by francis bacon... is something i had to revisit when i defined power as the capacity to cause change. because when framed like this it’s obviously more than a nice correlation: knowledge really *is* the capacity to cause change, therefore in some way, they actually are quite synonymous.

Page 91: How WebHooks Will Make Us All Programmers

Programming is the language of power.

If knowledge is power, then programming is the language of power. Programming is the most precise expression of how-to knowledge. You don't just program to express so much as you program to run, to make happen.

Page 92: How WebHooks Will Make Us All Programmers

Programming is about designing systems within the realm of computing, but as we trend towards ubiquitous computing, the boundary of "computing" and the rest of our world will start to disappear.

Page 93: How WebHooks Will Make Us All Programmers

our idea of what a computer is...

Page 94: How WebHooks Will Make Us All Programmers

has been unraveling right in front of us. abelson is right: it’s not about the “computer” ... it’s about something more. not even the “network”. i’m not exactly sure what it is... but

Page 95: How WebHooks Will Make Us All Programmers

Programmers are the most potent technologists.

i would like to make this assertion. the industrial revolution was about mechanization. i think software and automation are the new mechanization. only this time it’s much greater -- software gives us more bang for buck in terms of change caused by effort. it was software that allowed celebrity conan obrien to, with one click, change a person’s life.

Page 96: How WebHooks Will Make Us All Programmers

Technologists shape humanity.

and i think its undeniable how influential people are to society that can create and truly wield technology. but to bring it back to a little more concrete terms and where things are going:

Page 97: How WebHooks Will Make Us All Programmers

The world is trending towardsbecoming programmable

USA Today on CES: “You’re going to be hard-pressed to find a new gadget or gizmo in 2010 that doesn’t also connect you to web services.” That’s just a step away from having apis and hooks. Imagine a world where everything has an API and webhooks. Programmers can use it all as building blocks, literally programming the world around them. Magic indeed.

Page 98: How WebHooks Will Make Us All Programmers

Wizards.

programmers become not unlike wizards ... and wizards are basically gods.

Page 99: How WebHooks Will Make Us All Programmers

Why should we all learn to program?

Page 100: How WebHooks Will Make Us All Programmers

Why should we all learn to program?

“Program or be programmed.”

The world is becoming increasingly programmable. The power of programming will eventually

outweigh any reason not to.

Page 101: How WebHooks Will Make Us All Programmers

How do WebHooks foster programming?

3

obviously that kind of power, capacity to cause change, will be worthy of seeking out on its own once it becomes more obvious. what do webhooks and the evented web have to contribute? i think they’ll accelerate the process by making it more obvious, but there’s more.

Page 102: How WebHooks Will Make Us All Programmers

this is more generally about education.

Page 103: How WebHooks Will Make Us All Programmers

“Education is not the filling of a pail, but the lighting of a fire.”

—William Butler Yeats

framed my idea of education. inspiration and motivation are the real secrets to education. teaching is just a means to facilitate learning; learning happens by the individual.you need to inspire/convince the individual they want to learn ... and they will

Page 104: How WebHooks Will Make Us All Programmers

“The truth is that reading, writing, and arithmetic only take about one hundred hours to transmit as long as the audience is eager and willing to learn.”

—John Taylor Gatto

world renowned school teacher corroborates this idea.

Page 105: How WebHooks Will Make Us All Programmers

ackoff: one of the greatest thinkers of the 20th century that you probably haven’t heard of.greenberg: champion of the democratic school.

Page 106: How WebHooks Will Make Us All Programmers

Infrastructure as Education

Page 107: How WebHooks Will Make Us All Programmers

Village that not only didn't have access to computers, but didn't know English. Left the computer there with CDs (no Internet) and came back 3 months later. An 8 and 12 year old were playing a game on it and when they realized he had brought the machine, they said (in English): "We need a faster processor and a better mouse."

Page 108: How WebHooks Will Make Us All Programmers
Page 109: How WebHooks Will Make Us All Programmers
Page 110: How WebHooks Will Make Us All Programmers

“Creat ing content i s not what ' s important. What is important is infrastructure and access.”

—Sugata Mitra

MontesorriNatural languageGoogle.taking this idea, and returning to programming...

Page 111: How WebHooks Will Make Us All Programmers

how many of us started programming on something like these?

Page 112: How WebHooks Will Make Us All Programmers

programming was almost unavoidable on them.how many of you experience a noticeable physiological reaction to this screen?

Page 113: How WebHooks Will Make Us All Programmers

Programming is discovered.

today, the closest thing is myspace: css hacks to pimp your profile.but while this IS programming, it’s doesn’t convey the POWER of programmingeven though there’s automator on mac -- its sterile and limiting, pure utility. myspace style programming has relevance, expression, and... view source

Page 114: How WebHooks Will Make Us All Programmers

Programming is discovered.

today, the closest thing is myspace: css hacks to pimp your profile.but while this IS programming, it’s doesn’t convey the POWER of programmingeven though there’s automator on mac -- its sterile and limiting, pure utility. myspace style programming has relevance, expression, and... view source

Page 115: How WebHooks Will Make Us All Programmers

excellent viewsourceposse panel (missed it). my quick idea: view page source is a huge reason why there are so many web people (esp frontend)browser as a sandbox to explore and learn.unfortunately its not the cool stuff. it’s not the stuff that changes the world.

Page 116: How WebHooks Will Make Us All Programmers

twitter.addEventListener('newfollower', function(event) { var twitterUser = event.follower; var friends = facebook.getFriendsNames();

if (twitterUser['name'] in friends) { twitter.follow(twitterUser); } else if (twitterUser['following'] > 1000 && twitterUser['followers'] < twitterUser['following'] / 2) { twitter.block(twitterUser); }})

evented web gives us a sandbox to play with code that actually DOES cool and important things that are relevant to us. making the apps we use do more in a very personal and expressive way. the possibility space is much larger, and the language is richer, so it’s just begging for clever and creative exploration...

Page 117: How WebHooks Will Make Us All Programmers

How do WebHooks foster programming?

it gives us a new sandbox to “play” with our web applications together in new and useful ways.it provides the infrastructure to *just code* like on apple II or commodore. No dev environs, nothing to install. building directly on the shoulders of giants to easily achieve cool, useful, relevant “hacks” that I think would hook anybody on at least the idea of programming.

Page 118: How WebHooks Will Make Us All Programmers

How do WebHooks foster programming?

WebHooks and the Evented Web makeprogramming discoverable again

it gives us a new sandbox to “play” with our web applications together in new and useful ways.it provides the infrastructure to *just code* like on apple II or commodore. No dev environs, nothing to install. building directly on the shoulders of giants to easily achieve cool, useful, relevant “hacks” that I think would hook anybody on at least the idea of programming.

Page 119: How WebHooks Will Make Us All Programmers

and that’s how i think, in the long run, webhooks and the evented web will help make us all gods with the ability to *program* the world around us.

Page 120: How WebHooks Will Make Us All Programmers

@progrium#webhooks