61
Flickr A Case Study in Rich Internet Application Development Cal Henderson

Web Design World Flickr

  • Upload
    royans

  • View
    6.540

  • Download
    0

Embed Size (px)

DESCRIPTION

http://www.iamcal.com/talks/

Citation preview

Page 1: Web Design World Flickr

FlickrA Case Study in Rich Internet

Application Development

Cal Henderson

Page 2: Web Design World Flickr

Web Design World, 30th January 2006 2

Hi

• Cal Henderson

• Flickr Architect

• Yahoo! Inc

Page 3: Web Design World Flickr

Web Design World, 30th January 2006 3

Page 4: Web Design World Flickr

Web Design World, 30th January 2006 4

flickr.com

• Over 2 million users

• Over 93 million photos

• 368 TB of hard disk space– (376,832 GB)

Page 5: Web Design World Flickr

Web Design World, 30th January 2006 5

A flickr history

• Flickr started out as a Massively Multiplayer Online Game called “Game Never Ending”

• On February 10th, 2004, Flickr was launched at the Emerging Technology Conference

Page 6: Web Design World Flickr

Web Design World, 30th January 2006 6

A flickr history

• Our two year birthday is next week – come to our party!

• Saturday 11th February

• http://upcoming.org/event/51807

• There will be cake

Page 7: Web Design World Flickr

Web Design World, 30th January 2006 7

Vancouver, BC (not in America)

Page 8: Web Design World Flickr

Web Design World, 30th January 2006 8

A flickr feature tour

• Photos!

• On web pages!

Page 9: Web Design World Flickr

Web Design World, 30th January 2006 9

Page 10: Web Design World Flickr

Web Design World, 30th January 2006 10

A flickr feature tour

• How does it differ from other photo management services?

• Social network based

• Collaborative metadata

• Community aggregation

Page 11: Web Design World Flickr

Web Design World, 30th January 2006 11

Page 12: Web Design World Flickr

Web Design World, 30th January 2006 12

Page 13: Web Design World Flickr

Web Design World, 30th January 2006 13

Page 14: Web Design World Flickr

Web Design World, 30th January 2006 14

Page 15: Web Design World Flickr

Web Design World, 30th January 2006 15

Page 16: Web Design World Flickr

Web Design World, 30th January 2006 16

Flickr architecture

• Flickr is powered by a bunch of hardware in Texas and Virginia– A few hundred boxes

• It can be broken down into 3 chunks:– Web serving

– Photo storage / serving– Databases

Page 17: Web Design World Flickr

Web Design World, 30th January 2006 17

Hardware architecture

Storage Servers

Database Servers

Web Servers

Interweb

Page 18: Web Design World Flickr

Web Design World, 30th January 2006 18

Software architecture

Application Logic

Page Logic

Templates

API

Client / Browser

AJAX

Page 19: Web Design World Flickr

Web Design World, 30th January 2006 19

AJAX

• What’s that all about?

• Asynchronous Javascript and XML– Jesse James Garret, AP, Feb 2005

• Previously called “remoting”– Google maps, Gmail, Flickr et al

Page 20: Web Design World Flickr

Web Design World, 30th January 2006 20

AJAX History

• Started out as loading scripts into <iframe>‘s or writing <script> tags into the document

• Microsoft created XmlHttpRequest (1998)– Everyone else followed suit

• JSON appeared in 2005– Javascript object notation

Page 21: Web Design World Flickr

Web Design World, 30th January 2006 21

The roundtrip

• User initiates action

• Browser makes background request• Server does it’s thing

• Server responds

• Javascript in browser executes to handle response

• Response is displayed somehow to user

Page 22: Web Design World Flickr

Web Design World, 30th January 2006 22

The roundtrip

• User initiates action

• Browser makes background request• Server does it’s thing

• Server responds

• Javascript in browser executes to handle response

• Response is displayed somehow to user

Page 23: Web Design World Flickr

Web Design World, 30th January 2006 23

Browser compatibility

• Sounds too easy?

• Luckily all the browsers implement XmlHttpRequest slightly differently

• We can avoid the grief by wrapping the different implementations in a simple library

• For all browsers we just make a request and receive a response, hiding the ugliness

Page 24: Web Design World Flickr

Web Design World, 30th January 2006 24

AJAX Abstraction

• In fact, we care even less about the implementation when trying to get things done

• We can abstract away the entire request/response cycle, hiding the protocol

• We just receive a Javascript object – we don’t care if it came back as XML-RPC, REST or JSON

Page 25: Web Design World Flickr

Web Design World, 30th January 2006 25

Debugging AJAX Apps

• AJAX applications are harder to debug than static web pages– The client or server could be at fault

– You can’t see what’s happening

• We need special tools to:– See what gets sent over the wire– See what our code is doing

Page 26: Web Design World Flickr

Web Design World, 30th January 2006 26

Debugging AJAX Apps

• The simplest way to see what’s going on is to echo things out to the browser

• That’s what alert() was built for, right?

Page 27: Web Design World Flickr

Web Design World, 30th January 2006 27

Page 28: Web Design World Flickr

Web Design World, 30th January 2006 28

Page 29: Web Design World Flickr

Web Design World, 30th January 2006 29

Avoiding alert()

• alert() isn’t always the best solution

• If we want to dump a lot of data, creating a “debugging window” within the application makes our lives easier.

Page 30: Web Design World Flickr

Web Design World, 30th January 2006 30

Page 31: Web Design World Flickr

Web Design World, 30th January 2006 31

Sniffing the wire

• With AJAX applications, we care about the data going over the wire

• If we can see the HTTP traffic, we can make sure we’re sending the right requests and that the server is acting as we expect

Page 32: Web Design World Flickr

Web Design World, 30th January 2006 32

Ethereal

• Ethereal lets us grab and analyze all network traffic– http://www.ethereal.com/

– Windows, Linux, Mac (via fink)

Page 33: Web Design World Flickr

Web Design World, 30th January 2006 33

Page 34: Web Design World Flickr

Web Design World, 30th January 2006 34

Sniffing the wire

• This is great to see what’s going on, but it’s a read-only tool

• It would be really nice if we could edit requests and responses on the fly to help us test different scenarios

Page 35: Web Design World Flickr

Web Design World, 30th January 2006 35

Fiddler

• Fiddler from Microsoft– http://www.fiddlertool.com/– Free– Windows only– Works best with IE, but also works with FF

Page 36: Web Design World Flickr

Web Design World, 30th January 2006 36

Page 37: Web Design World Flickr

Web Design World, 30th January 2006 37

Debuggers

• Beyond looking at the traffic, we need to be able to see what’s going on in our guts

• In the old days, we had to be content with alert() statements and patience

• In these enlightened days we have debuggers ;)

Page 38: Web Design World Flickr

Web Design World, 30th January 2006 38

Visual Studio

• Microsoft have a free version of Visual Studio (Visual Studio Express) which contains their IE debugger– http://msdn.microsoft.com/vstudio/express/

• Full debugger environment– Watch lists– Breakpoints– Stack tracing

Page 39: Web Design World Flickr

Web Design World, 30th January 2006 39

Venkman

• For those of you with a Firefox preference, Venkman provides the same features– http://www.mozilla.org/projects/venkman/

– Free– Open source– Quite ugly

Page 40: Web Design World Flickr

Web Design World, 30th January 2006 40

Page 41: Web Design World Flickr

Web Design World, 30th January 2006 41

Dynamic pages

• Now that we routinely manipulate the DOM, we don’t always know what state the “source” of the page is in

• New tools help us introspect the DOM on the fly

Page 42: Web Design World Flickr

Web Design World, 30th January 2006 42

Firefox

• Choose ‘custom’ install when installing Firefox

• Adds a “DOM Inspector” option to the tools menu

Page 43: Web Design World Flickr

Web Design World, 30th January 2006 43

Page 44: Web Design World Flickr

Web Design World, 30th January 2006 44

IE Dom Tools

• IE Instant Source Viewer– http://www.blazingtools.com/is.html

• IE Dom Inspector– http://www.ieinspector.com/dominspector/

• IE Developer Toolbar & Dom Explorer– http://www.microsoft.com/downloads/

details.aspx?FamilyID=e59c3964-672d-4511-bb3e-2d5e1db91038

Page 45: Web Design World Flickr

Web Design World, 30th January 2006 45

Page 46: Web Design World Flickr

Web Design World, 30th January 2006 46

AJAX in the wild

• We can build whole applications in AJAX, but there are drawbacks

• Having URLs for resources are important

• Smushing everything into a single interface gets ugly quickly

Page 47: Web Design World Flickr

Web Design World, 30th January 2006 47

AJAX in the wild

• We can use AJAX to allow click-to-edit functionality, avoiding two page roundtrips

• For discrete pieces of functionality, we can create small AJAX applications– Organizer

Page 48: Web Design World Flickr

Web Design World, 30th January 2006 48

Page 49: Web Design World Flickr

Web Design World, 30th January 2006 49

Web 2.0?

• Web 2.0 is the talk of the town

• Web 2.0 isn’t all about AJAX

• What can we learn from Web 2.0?

Page 50: Web Design World Flickr

Web Design World, 30th January 2006 50

Five ways to love web 2.0

• Collaboration– Embrace collaborative metadata

– Don’t ghettoize your users

Page 51: Web Design World Flickr

Web Design World, 30th January 2006 51

Page 52: Web Design World Flickr

Web Design World, 30th January 2006 52

Five ways to love web 2.0

• Aggregation– Use the data you have

– Create new avenues of exploration– Present new views on old information

Page 53: Web Design World Flickr

Web Design World, 30th January 2006 53

Page 54: Web Design World Flickr

Web Design World, 30th January 2006 54

Five ways to love web 2.0

• Open APIs– Help 3rd party developers to help you

– Eat your own dog food for AJAX

Page 55: Web Design World Flickr

Web Design World, 30th January 2006 55

Page 56: Web Design World Flickr

Web Design World, 30th January 2006 56

Five ways to love web 2.0

• Unicode– Aim for I18n/L10n from the outset

– Don’t forget the rest of the world

Page 57: Web Design World Flickr

Web Design World, 30th January 2006 57

Page 58: Web Design World Flickr

Web Design World, 30th January 2006 58

Five ways to love web 2.0

• Open content– Creative commons

– Allow your content to live beyond your application

– Turn your application into a resource

Page 59: Web Design World Flickr

Web Design World, 30th January 2006 59

Page 60: Web Design World Flickr

Questions?

Page 61: Web Design World Flickr

Thank you

These slides are available from the conference website and at

http://iamcal.com/talks/