Tag Archives: API

The Paradox of Black Boxes

When I was a young programmer, I was developing an application for a client — it may have been for Windows 3.1 or Mac System 6, I don’t remember — and my code just wouldn’t work. I banged my head against it for quite a while, and just couldn’t see any errors.

So I made an intellectual leap. One of youth and hubris, in part. I concluded that there was a bug in the system’s API. Somehow, in the millions of lines of code that comprise the (then-new) operating system, a bug had been placed that was causing my code to fail.

Incensed, I dashed off a bug report and posted indignantly to a programming community (probably on CompuServe or AppleLink). My unhappiness at the bug was trumped only by my self-righteousness at finding someone else’s.

But of course, you know the end of this story. My indignation and feeling of superiority evaporated quickly when the programming community noted no such error in THEIR code, which took me back to my own — where I found my problem. My happiness at solving the problem was eclipsed by my embarrassment.

This may be an anecdote borne of, as I mentioned, youth and hubris, but it also derives from another phenomenon: the black box. My code was relying on someone else’s code, so when mine didn’t work, it was intuitive to blame the mystery “other” code.

This happens all the time today — likely more than at any time in recent memory — because of the rise of modularized code. It is trivial today to take code libraries from multiple places, call a remote API or two, and package it up as a new application. In fact, in some cases, it increases one’s efficiency by several orders of magnitude.

This is the virtue of the black box. We can drop one in whenever we need specific functionality and we don’t have to do much to make it work.

The difficulty, however, is in provenance. Who knows how that code was written, or how well it works? You can get a sense of the latter often by doing some web searching, but if you are using a narrow-niche kind of code where few use it, or you are using a “black box” in a corner-case/niche-y way, you may not be able to rely on the commons.

So what’s the answer? Surely it’s not to build everything yourself from scratch. If that were true, we’d all be releasing our own versions of iPhone operating systems to go with our applications, and it would be worse than the Android fragmentation! (Kidding, kidding. Mostly.) Rather, it’s to be judicious when using external libraries and APIs, to do so where you can degrade gracefully if something breaks, and to code defensively, handling any errors or anomalies that could involve the foreign code.

Because even though it’s unlikely, it’s possible that next time, it really WILL be the black box code that’s broken, and not my application. And that will make my younger self smile.

WebRTC: Live web audio/video chat without plugins

Most of the design and development technologies we work with every day are in ‘evolution’ mode, not ‘revolution’ mode. Enhancements are made, bugs are fixed, but the leaps are relatively small. A browser here adds support for the latest HTML5 canvas feature, a device there adds an API for better map coordination. Nifty, but a little light on the ‘wow factor.’

With the release of Firefox 22 this week, though, there’s a browser advancement that has the potential for a real leap: WebRTC is now baked-in and turned on by default. That means both Chrome and Firefox have it up and running in their latest versions. It will soon be ubiquitous (or perhaps ubiquitous-ish until IE follows along…).

Why is this so great? WebRTC is a W3C standard that allows for real-time communication (thus the RTC) in the browser — audio chats, video chats, whatever. No plug-in for users to download and install. Cross-platform and cross-browser compatible. Just code and go.

It will soon be much more trivial to just throw a video customer-service chat on a help-desk website. Or bake it into a community website to allow for in-site community chats. Or integrate it with the many more social networking sites with varying results depending on the site (you can let your imagination run on that one).

The possibilities are pretty remarkable. It’s a great case of where the technology itself has been around a long time, but by establishing a standard, the power is in the interconnection. Like, I don’t know, almost all Internet-based technologies.

There’s a good getting started tutorial over at HTML5 Rocks, and you can also jump off of the WebRTC home page. Either way, it’s worth a click-around. I think this will be big.