Tuesday, July 8, 2014 at 6:26 AM

Why the Facebook API works better for me

Yesterday I wrote a piece that compared the APIs of Twitter and Facebook. I said it took 3 months to do with Twitter what took 4 days with Facebook, but I didn't say why it was so much easier with Facebook. Mea culpa!

  1. First, it's important to know that I'm developing in JavaScript in the browser.

  2. If I don't have to write server software then it goes much more quickly.

  3. With Twitter, I can't call directly to their API from the browser. I have to write an intermediate server app that calls on my behalf, and call that.

  4. So I create a server app, and a simple interface for my JavaScript code running in the browser. That's what took the 3 months. I had to work in another environment, Node.js. I was still coding in JavaScript, and I already had a couple of projects under my belt in Node, so while some of the 3 months was spent learning Node, I already knew how to build Node-based server apps when I started.

  5. Why it was faster: No need to write that server app for Facebook. They did all the work. This is called factoring, and it works much like factoring in algebra. By the time I saw their API it had a simple in-browser JavaScript interface, that works more or less like the one I built for Twitter, for myself. That's why I zoooooomed through the Facebook project. :heart_eyes_cat:

  6. Another advantage of the Facebook approach (which is also used by Dropbox, and recently by Amazon web services) is that because I don't have to run a server, I don't have to buy more server resources if my app becomes popular. They take care of the scaling for me. Which seems fair, they're already going to have to scale their server to accommodate my users. Why do both of us have to do it? Answer: it's duplicate effort. No need.

I've written about this before. I believe in static JavaScript apps. It's the way to go. Services like Twitter, WordPress and Evernote would do well to make it easy for browser-based apps to call directly to their servers. Imho, of course.

Last built: Sun, Mar 22, 2015 at 5:51 PM

By Dave Winer, Tuesday, July 8, 2014 at 6:26 AM. Good for the environment.