002 JSJ The Right Way to Build Web Applications




Javascript Jabber show

Summary: Panel AJ O'Neal (twitter github blog) Charles Max Wood (twitter github Teach Me To Code Rails Summer Camp) Jamison Dance (twitter github blog) Yehuda Katz (twitter github blog) Discussion JSON Build the API first Resources Serializer Gem (Ruby) Efficient for widely used browsers Ember.js Ruby on Rails Data Binding Backbone.js Truth in DOM Events MVV vs VVV vs MVC Knockout.js Spine.js Angular.js Batman.js REST HTTP Spec Picks Mike Burbiglia (Jamison) Inu (Jamison) Oh Darling - Plug In Stereo (AJ) Parse.com/docs/android_guide (AJ) The Yellow Lighted Bookshop (Yehuda) Mou (Yehuda) Mountain West Ruby Conference (Chuck) Outliers (Chuck) MacVim (Chuck) Janus (Chuck) Transcript YEHUDA: I now have to make a thing that's probably going to live with me forever. CHUCK: Disclaimer, this is Yehuda’s opinion and only Yehuda’s opinion. So, if you don’t follow it, you are stupid. CHUCK: Hi everybody and welcome to the JavaScript Jabber podcast! This is Episode 2 and this week on our panel we have Yehuda Katz. YEHUDA: Hello, great to be here again. CHUCK: We also have Jamison Dance. JAMISON: Howdy! Nice to be here too. CHUCK: We also have AJ O’Neal. AJ:  It's Wednesday and we're so excited! CHUCK: And I'm Charles Max Wood from teachmetocode.com and this week we're going to be talking about How To Do Web Apps Right (or something like that). YEAHUDA:  Yeah, it’s hard. CHUCK: Yes it is hard. JAMISON: [crosstalk] – some PHP right? YEHUDA: Things are good. CHUCK: Absolutely. Well you kind of bring up a good point there, is that everybody kind of has their own way of wanting to do this. I mean, some people, they just kind of throw out layout together and they do a big JavaScript front-end. Other people tend to use something like Ruby on Rails or PHP or something to build an API, that then the JavaScript front-end can use. And then there are other people that just do it all with like page refreshes and hairy AJAX calls. YEHUDA: Yeah I believe 37Signals does the AJAX calls and page refreshes based on what--- CHUCK: So I think there are a lot of different ways like you pointed out to do it. But what is your preference? Or what are you guy’s preference? AJ: My preference is to actually build the API first. It seems like a lot of sites have API as an afterthought. So if you're going to build it anyway, why not build the API and then use your API in your app, so your API is tested because you're the one using it as well. YEHUDA: Yeah I think as more people are building other front-end, so if you are building iOS or an Android app, you're going to need an API anyway. I think treating your web front-end as the equivalent of an Android or iPhone app, --- to say, but if you can do something like that, that that's a big one I think, along the lines of what you just said. CHUCK: Right so when we talking about APIs, are we talking about something like JSON APIs since this is a JavaScript show or XML API or does it matter? AJ: JSON. YEHUDA: Not an XML API. [Laughter] No, so I am not going to be controversial by saying I prefer JSON APIs, but part of the reason why I prefer JSON API is that, I actually like to have my front and my back end—(let me back up)... So a lot of people who build API do like handcraft APIs where every resource that they build, they are like, “Okay what things should I expose? What should I name everything? Where should I attach my associations? And what should happen with these errors.”  I like to build applications where the answer to all those questions for every resource is always the same. So I built “Serializer Gem” that enforces that. But basically, if that is the case, if everything is the same, if the answer for associations is a long side and the answer for errors is an error sash and if your frond-end is JavaScript, it’s really nice to be able to just basically just say,