Web Directions Code 2013

Tómate JavaScript en serio gracias a Backbone.js

Jeremy Ashkenas  · 

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

thank you hello everybody thanks to John and Maxine for inviting me back here I was actually just in Melbourne about three months ago and it is lovely to return although a little bit chillier this time of year and we're gonna talk a little bit about backbone.js

today I figured that would be a good topic for this particular crowd and to get a rough sense how many of you have a used backbone before in any way Wow so that's a pretty great great a percentage but not everyone so we're gonna try to do sort of backbone

itself is not a very large thing so we can cover hopefully many parts of the aspects of it a lot of the philosophy and a little bit deeper into sort of the the rationales in our 50 minutes if you have any questions I'm gonna try to leave some time for

questions at the end so write them down on those notepads during the talk if you have anything and we'll get around to it and I tried to spice this up a little bit with some pictures of your beautiful country as as we go through so backbone is a library

to help you build rich JavaScript applications if you're taking JavaScript seriously in your web application it tries to be sort of a minimal library that helps you get done those common patterns that you always have to get done and it's still actually

less than a thousand lines of actual JavaScript there's really not much to it and so we could probably use this 50 minutes as to do a thorough code review and go through every single line but that would not be maybe the most interesting thing so to give

you a bit of background it was released to the public a little bit over two years ago and since then of course there's been all kinds of things done with it which we'll touch on briefly and many other libraries sort of in that space right there's

always been JavaScript libraries to help you build JavaScript applications but originally they were sort of a different nature a little bit more comprehensive and full-featured and geared towards making different types of UI than you would normally do on the

web and recently we've seen all differ kinds of angles of you know libraries that just think about templating or just deal with SVG and canvas or in particular aspects of UI also ones that go end to end ones that say you have to use this database and if

you use this database and this web server and this client-side library will plug all those pieces together for you so there's all different kinds of ways to tackle this problem and backbone is a very particular approach and it also started what is perhaps

an unfortunate naming convention so now apart from backbones is we also have spine j/s ligament j/s vertebrae j/s plain old bones which is actually a project that adds more rest server side capabilities to backbone and I think that hambone Jas and shin bone

Jas are still open if anyone wants to jump on it so backbone was extracted from document cloud document cloud is the original backbone application what it is is the knight Foundation which is part of the Knight Ridder newspaper chain company the two brothers

who founded it left a large part of their fortune to a foundation that gives out grants for journalism slash technology projects which is of course a pretty interesting space to be in so the news challenge which is one of the projects that the knight foundation

runs is is a contest where they give away a whole bunch of money to to open-source projects that aim at helping journalists get their job done or helping readers read read the news so backbone was one of the one of the larger winners in 2009 I mean starting

out backbone document cloud is one of the larger winners in 2009 and the idea with document cloud is that as a reporter if you're working on a story oftentimes the vast majority of your source material for the story is from documents right you're getting

documents from sources directly or getting documents from the government getting documents that are already public domain and you're reading through them you're annotating them you write finish and publish your story and when you have your article

printed basically all of the source material gets forgotten about it's locked up in a filing cabinet somewhere your readers never see it because in a print newspaper there's no place to share your source material with them right there's there's

no physically no room but online that's not the case right on the web you have as much space as you want and it's kind of crazy that if you're writing this really really well researched and backed up story that you wouldn't want to share your

sources with your readers because it gives your article that much more punch so the view with document cloud is to make it easy for journalists to have a rich work space where they can upload their source material search through it have it be analyzed by by

the service to show the people places organizations and terms that are mentioned in the documents you can take notes inside of it and then share your notes and your documents the original source material with your readers when you publish the story so basically

a an application that needs to feel sort of comfortable to work inside of something you need to be able to log into you know manipulate your documents categorize them search through them take notes on them share your notes with other users of the system may

be in a different newsroom somewhere else basically the kind of application that really calls out for taking JavaScript seriously where if you did it with just a series of static pages and filling out forms and clicking submit you could imagine that it wouldn't

be as nice of an experience to to work with so that's the original extraction and part of this is the way that the night foundation set things up so one cool thing about the news challenge is that everything that you do as part of your project is supposed

to be open sourced at the end and there's different approaches to doing this right so in the past before we got started some some older night foundation grantees had done the open source model by working on their application for two years for the grant

period and then on the last day of the grant publishing a tarball of their code base and then never touching it again right which technically of course is one way to open-source it but it's not really in the spirit of the thing so what we tried to do is

when as we worked on the application examine all the different pieces that went into it and try to think you know is this a piece that would make sense on its own does it does it have an API that is consistent and makes sense on its own and would it be useful

in another project and so there's things like underscore Jess came out of that which is basically all of the utility helper functions that also service as the core of backbone but that can be useful in their own right just working on raw Jason and then

backbone which makes use of that to give you rich data models and views things like jamot which is an asset compression sorry asset asset a sort of pipeline library before the asset pipeline was in rails 3 and a couple of other things um that are kind of standalone

pieces so apart from document cloud in those two and a half years or so in the wild there's been all kinds of stuff that's been that's been built with backbone from newspapers the new reuters.com which is just in preview now as I think of yesterday

or the day before they just launched it it's kind of fun USA Today a quartz which is a new sort of financial and business oriented newspaper online sales forces comms public development platform was just from last week for better for worse I believe it's

now being back ones being included in the new releases of WordPress these days for I guess making a richer richer development easier to get started with lots of music sites like our do Pandora SoundCloud ear bits movie sites like Hulu online learning Khan

Academy inkling code school music magazines which is a fun use case for rich JavaScript approach because you wouldn't usually think of them as being a natural fit magazine more of a printed page kind of a thing online but pitchfork and spin and a couple

others interactive art galleries a Google Art Project in artsy and then all kinds of analytics and management of which may be the stripe management interface is a great example of having analytics in a rich backbone application all of which is to the point

of saying that there is no sort of typical backbone app right it's being used for things as small as little widgets that get embedded on pages up to clients for doing online matching for games it's being used on the desktop and map making software

with web views for for doing sort of your own custom apps as an alternative to just stock Google Maps magazines and newspapers like I mentioned interactive graphics where you're not you're not building the entire application but you're doing the

really richly you know of graphic to fit inside of a larger piece iPhone and Android apps that are using JavaScript and visual art galleries and also these things are just the tip of the iceberg right these are just the ones that I happen to have heard about

that people email me about but there's probably you know 98% more modest backbone apps out there all kinds of stuff that you guys are working on and a whole host of knowledge tricks tips and techniques that is great for folks to share so I'm hoping

to maybe hear more about some design patterns from some of you or neat tricks that you've pulled off because especially at this point I feel like maybe during the first year I might have been able to have sort of a rough sense on what kinds of things people

were doing with with backbone but these days sort of my experience with it and working on document cloud you know mainly and extracting it is this tiny fraction of sort of interesting approaches that people have done people have taken it you know there's

a whole bunch of plugins that extend it in different ways and and a whole bunch of folks who have used it in in directions far beyond the original idea people who are using it on the server side and the client side people who are using it on the desktop and

so I'm always eager to hear more about those kinds of things so I'd like to start by exploring the the question and the problem a little bit why do we take JavaScript seriously these days why are we why are we using it all right it's everyone's

favorite language to love to hate so why do we why do we focus on it and I think that the answer to this question is because fundamentally it is a more powerful way to build web applications than then we used to have right there are certainly still folks out

there fighting against this I think this truth right with Russian doll caching or whatever you might want to do but but using JavaScript seriously and respecting it is a way to take advantage of sort of the native nature of not just you know the web interfaces

but computer interfaces right probably a lot of you guys have already seen a recent brett victor talk from a couple days ago that was published a stopped drawing dead fish but if you haven't you should check it out to summarize briefly in it he argues

[ ... ]

Nota: se han omitido las otras 5.618 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.