What's an API designer to do?
Skip navigation.
Home
Computer news

What's an API designer to do?

programming

So here's an interesting question that I'd like to pose to my silent readership: how would *you* solve this particular issue, and why would you solve it in that particular way.

Let's say you have a published API called Foobar, and Foobar's job is to tell you whether the user can access a particular resource. This API was sensible when you first published it, but over the years, the operating system has changed the game a bit. Now the OS has decided that the user can have "pretend access" to a particular resource in some circumstances, but they don't have true access to it. Instead, they have access to a resource that mimics the original, but is really just a proxy. What should the behavior of your API be? Should it report back whether the caller has access to the *actual* resource, or whether it has access to the *proxy* resource when dealing with this special case?

I think this is a hard case to solve, since the answer really can go either way. From one perspective, you can access the resource since the ultimate operation still succeeds. From another perspective, you can't access the resource because the operation fails on the intended target resource. So, given an existing API, what's the proper answer when the OS changes the rules after the API's been published?