Web APIs: The future of software

Description

Since the beginning of software, we have bundled frequently-used functionality into libraries -- both our own, and those created by third parties. APIs tell software developers how to use a library, and make it possible for developers to treat libraries as black boxes, considering only what the library does, not how it does it.

Today, as software moves increasingly to the Web, APIs and libraries are also moving to the Web. This means that you can now outsource, by means of Web APIs, a huge amount of your application's functionality.

What does this mean for software developers? What does this mean for the future of software development? In this talk, I describe the past, present, and future of APIs, and how I believe the Web is changing the landscape.

Software • Software is the magical collection of instructions that control a computer • At the end of the day, we know that there are ones and zeroes in there. • No matter what language you use, the programs you write are turned into ones and zeroes when they are executed.

Abstraction • So, why not just use ones and zeroes? • Abstraction: One of the most important concepts in computer science! • Abstraction lets you think big thoughts, not worrying about the underlying infrastructure or implementation

High level • The greatest abstractions happen in "high-level" languages, such as Python, Ruby, JavaScript, and Lisp • In low-level languages, I work hard to suit the computer. • But in high-level languages, the computer works hard to suit me, by black-boxing the details!

Repetition • No matter what language you use, you'll eventually ﬁnd yourself repeating code. • How can you deal with this problem? • Put the code in a common place, and then use it again and again. • Write it once, and then use it — ignoring the implementation

Programmer virtues • "The three virtues of a programmer: laziness, impatience, and hubris" — Larry Wall • Laziness: Write it once, and then reuse it many times!

Libraries of code • Writing libraries of code, which can then be used by many different programs, is an extremely common programming task. • With a library, we can concentrate on the most important things to our business, rather than focus on infrastructure.

API • "Application Programming Interface" • What is the interface to a library of code? • Function/method names • Effects (what each function does) • Parameters expected by each function • Return value(s) from each function • What happens if there was an error?

Modern operating systems • What is an operating system? A bunch of libraries that abstract away the hardware and many other aspects of computers: • Networking • Printing • Running multiple programs • Drawing to the screen

Operating systems • In other words, an operating system is just a collection of APIs! • You can write your own printing system, but why bother? Just use the printing API that the operating system provides.

RPC • "Remote procedure call" • Don't invoke a library on the local computer — rather, invoke it on another computer! • Abstraction #1: The software library does some task for me • Abstraction #2: I don't have to know how that things are executing remotely

What is the Web? • URLs — what I want, where it's located, and how I get there • HTTP — a great way to get there • HTML — a type of content

The entire Web, explained • A browser sends an HTTP request to a server. • The server sends a response (perhaps content, perhaps an error message, perhaps a redirect), and hangs up.

What if machines browsed, and not humans? • The Web was designed for people. • But you know, the combination of URLs, HTTP, and HTML could be used by computers, too. • And then you wouldn't need to have a "browser" sending a request. It could be any program, right?

XML • "Extensible markup language" • Not a markup language, but rather a way to deﬁne new markup languages! • Now computers can send requests and get results not in human-centric HTML, but in machine-centric XML.

XML-RPC • Dave Winer suggested that we could use a combination of XML and HTTP for RPC! • • Works across programming languages • Used libraries (XML, HTTP) that already existed • • Works across the Internet Set up a client or server in minutes! But is this really RPC? Actually, yes!

"Web Services" • Both XML-RPC and SOAP are protocols that let you advertise Web services • In other words: APIs against which we can make calls from anywhere on the Internet! • There's a whole alphabet soup of standards that were written to address this problem. • But today, APIs are often cleaner and leaner than this, implemented in different ways

REST • Representational State Transfer (Roy Fielding) • URLs should be nouns, and different HTTP actions should describe the actions on those nouns • Not a lot of documentation is needed, because REST standardizes how things look on the outside • Wait, how does it look on the inside? What does the implementation look like?

JSON • JavaScript is everywhere! • And JavaScript syntax is easy to understand • So Douglas Crockford created "JSON" — JavaScript Object Notation — which makes XMLRPC look clunky and fat by comparison • A huge number of programming languages support JSON

REST + JSON • Modern APIs are thus standardized via REST, and exchange data using JSON • Many frameworks, such as Ruby on Rails, make it trivially easy to create RESTful JSON APIs

Um. OK. • Web APIs let programs talk to other programs. • And? Why should I care? And how is this the future of software? • Two reasons: • All software is moving online, and • The entire Internet is becoming our OS!

If an OS is a collection of APIs you can call, then the Internet is becoming a massively distributed OS!

In other words • Build the parts of your application that are special and speciﬁc for you. • The rest of your application should leverage APIs on the Web • And by the way, your application can offer APIs as well, leading to a complex web of API calls!

Example: FedEx • One of the ﬁrst companies to offer an API • (Yes, beyond the Web site!) • Beneﬁt to your company: Create custom software that handles all of your package needs, with the appropriate permissions and reporting • Beneﬁt to FedEx: Lock-in, customer satisfaction

Example: Payment • It used to be difﬁcult to deal with payment and ecommerce — because you implemented it yourself • But now we have APIs that make it easier to deal with. PayPal, Strip, Dwolla, Amazon, PayByGroup. • How can we simplify the API? Simple: Offer a library that wraps up those APIs. • Charging credit cards becomes a one-line task!

What does this mean? • The New York Times is not only a source for news. • It's now a source for data that people can use to inform others. • It becomes a platform on which you can create new content, and do meta-reporting

Weather APIs • wunderground.com offers APIs to current weather data • Get weather data, and integrate it into your app • Location-aware apps on your phone can use this to show weather wherever you are!

Amazon?!? • Yes, they make billions off of their cloud servers • You can manage those servers via various APIs • Want to manage buying, selling, and management of products on Amazon? Sure, there are APIs for those, too…

Geocoding • Have a street address, and want to know its longitude and latitude? • Have an IP address, and want to know its country? • There are APIs for this, generally from mapping companies (e.g., Google, Bing, MapQuest)

A/B Testing • optimize.ly lets you do A/B ("split") testing on your Web site by including a snippet of JavaScript • How does it work? By accessing Optimizely's API • How can you modify its behavior? By accessing Optimizely's API from your own program!

Storage • Dropbox and Google Drive offer APIs! • Store and retrieve Dropbox documents from within your program • Use Dropbox for storage, and it automatically replicates!

Facebook • Get access to a user's personal information — name, address, and interests • You also get information about the person's friends! • This is potentially a huge privacy issue! So users need to agree to add Facebook API applications, and speciﬁcally see what capabilities apps want • (The same is true for LinkedIn, of course.)

Twitter • Twitter has long offered an API, allowing anyone to tweet from within a program • (You can also read and search through tweets)

Using the API def tweet_person Twitter.update("Welcome, #{fullname}, to the #NetLogo Modeling Commons, our #{ActiveSupport::Inflector::ordinalize(Person.count)} user!") end

SOA • Service-Oriented Architecture • Instead of a big Web application, write many small ones that talk to each other via APIs! • Each service can then be created, updated, and maintained by different teams. Or companies. Or individuals. • Easier to create, maintain, scale, and understand

SaaS APIs • SaaS — software as a service • Applications that run on a server somewhere; they may have a browser-side, as well. • A growing number of SaaS companies offer APIs. This turns the application into something beyond what you use it for in your browser.

Example API: Harvest • "Harvest," time-tracking and invoicing software, has an API • The time-tracking API lets you keep track of your time. Build a new widget or app that starts and stops your clock, for example. • The extended API lets you edit your clients, projects, and tasks!

Example API: Job seeking • Looking to hire people? You can use an API to post jobs (on monster.com, linkedin.com, and elsewhere) • Looking for work? You can search via an API! • Trying to match jobs and people? You can use these APIs, and build a company on top of them!

Example API: Search • Run searches against your favorite search engine • • (Or run searches against multiple search engines, and compare the results!) All search engines provide APIs that let you build on top of what they offer

ProgrammableWeb.com • Not sure what's out there? • ProgrammableWeb.com lists as many APIs as it can, categorized by topic, protocol and data format. • Don't reinvent the wheel — ﬁnd one that has already been rolling for a while, and integrate it! • (Let someone else do the hard work of implementing things. Laziness wins again!)

Connecting • IFTTT ("If this, then that") • It's an connector for APIs! • You can say, "When I'm tagged in a photo on Facebook, post a note to my blog." • Once a company is part of the IFTTT family, you can connect APIs for added

Mobile apps • Mobile apps all use APIs! • They usually talk to Web sites via XML or JSON • In other words, a mobile app has two parts • • • Client (running on the device) Server (offering a JSON API) Support iOS and Android? Two clients, one API!

Single-page apps • As browsers get smarter, more of the app is being pushed onto the client, running in JavaScript • So instead of each click being a new HTTP request, you can create a whole application in the browser that occasionally syncs with a server • How does it sync? APIs, of course! • Google Docs work just like this

Even the browser… • How do programs talk to the browser? Via APIs! • DOM — API for us to read and update a Web page • Call APIs from the browser, to talk to lots of servers • e.g., Disqus, Facebook, LiveFyre — add discussion to any page!

Make a fortune! • The path to startup success: 1. Come up with an idea 2. ??? 3. Proﬁt!

What's stage 2? • The path to startup success: 1. Come up with an idea 2. Offer an API to information or analysis that no one else can offer 3. Proﬁt!

$

Opportunities in your work? • An API doesn't have to be big or complex • It can often solve simple problems — saving you money and making you more efﬁcient • Don't e-mail Excel ﬁles to one another. Rather, create an API on a local server!

Web API, Cloud - codingthis.com

We all will be coders: Don't fear the future of software ...

Java APIs; Java App Dev; Java Web ... Don't fear the future of software ... will be mostly used to code configuration of the software applications of the ...Read more

Cloud Services - Deploy web apps & APIs | Microsoft Azure

Learn about Azure Cloud Services, which help you deploy and scale powerful web applications and APIs. Supports Java, Node.js, ... and ship software;Read more

These presentations are classified and categorized, so you will always find everything clearly laid out and in context.
You are watching All you need to know about the Microsoft Band presentation right now. We are staying up to date!