An application programming interface (API) is the specification for which software is meant to be used by other software.

learn more… | top users | synonyms

355
votes
33answers
140k views

How do I create my own programming language and a compiler for it [closed]

I am thorough with programming and have come across languages including BASIC, FORTRAN, COBOL, LISP, LOGO, Java, C++, C, MATLAB, Mathematica, Python, Ruby, Perl, JavaScript, Assembly and so on. I ...
86
votes
10answers
6k views

Strategy for keeping secret info such as API keys out of source control?

I'm working on a website that will allow users to log in using OAuth credentials from the likes of Twitter, Google, etc. To do this, I have to register with these various providers and get a ...
77
votes
14answers
70k views

Why aren't more desktop apps written with Qt? [closed]

As far as I know and have understood in my experience with Qt, it's a very good and easy to learn library. It has a very well designed API and is cross-platform, and these are just two of the many ...
75
votes
13answers
18k views

What's the difference between an API and an SDK?

I was looking through various APIs and SDKs, when I realized that I couldn't really tell the difference between something called an API and something called an SDK. Both of them are, conceptually, a ...
55
votes
5answers
3k views

Why were Java collections implemented with “optional methods” in the interface?

During my first implementation extending the Java collection framework, I was quite surprised to see that the collection interface contains methods declared as optional. The implementer is expected ...
46
votes
2answers
2k views

Why have hardware-accelerated vector graphics not taken off?

I'm working on an app that involves real-time manipulation of vector paths at 60fps, and I'm very surprised by how little information there is on the subject. At first, I tried to implement my idea ...
33
votes
3answers
6k views

What's so bad about the DOM?

I keep hearing people (Crockford in particular) saying the DOM is a terrible API, but not really justifying this statement. Apart from cross-browser inconsistencies, what are some reasons why the DOM ...
31
votes
8answers
3k views

How can I write a set of functions that can be invoked from (almost) any programming language?

I'd like to find a way to write an API that can be accessed from any other programming language via language bindings (or some other framework). Is it possible to do this? If so, which programming ...
28
votes
2answers
2k views

Should a website use its own public API?

I am starting to write a webservice, and I've built with nodeJS and a RESTfulish approach. From what I gather: The advantage is that you don't have to duplicate code. The disadvantages are that ...
23
votes
3answers
33k views

Difference between Web API and Web Service?

I have heard about Web Services and Web API's a lot, is there any difference between them or are the same?
22
votes
2answers
2k views

What does it mean to expose a C++ code publicly as a C API and what are the advantages of doing it?

I often hear people say that C++ programmers should expose their library's/product's public API as a C API. What does that mean and what are the advantages of that?
22
votes
4answers
842 views

Prefer examples over documentation. Is it a behavioral problem?

Whenever I come across a new API or programming language or even simple Linux man pages, I always (ever since I remember) avoided them and instead lazily relied on examples for gaining understanding ...
22
votes
10answers
2k views

API design: concrete vs. abstract approach - best practices?

When discussing APIs between systems (on the business level) there are often two different point of views in our team: some people prefer a more - lets say - generic abstract approach, other a ...
21
votes
9answers
2k views

Interface naming: prefix 'Can-' vs suffix '-Able'

It's common to use '-able' as a suffix for interfaces e.g. Serializable Printable Enumerable Drinkable Shootable Rotatable I was thinking that 'Can-' might better because it may be more descriptive. ...
21
votes
7answers
1k views

How do I manage a very large set of rules and magic numbers in my program?

I'm somewhat new to programming (I'm a mechanical engineer by trade), and I'm developing a small program during my downtime that generates a (solidworks) part based on input from various people from ...
20
votes
11answers
4k views

Is it a really required skill to program without API documentation?

I barely passed my Java programming exam today. I had to answer some general questions about threading which I did well and to write a little threaded program which was worse. I had to connect my ...
20
votes
8answers
5k views

When to use HTTP status code 404 in an API

I am working on a project and after arguing with people at work for about more than a hour. I decided to know what people on stack-exchange might say. We're writing an API for a system, there is a ...
20
votes
2answers
2k views

Should one always know what an API is doing just by looking at the code?

Recently I have been developing my own API and with that invested interest in API design I have been keenly interested how I can improve my API design. One aspect that has come up a couple times is ...
20
votes
4answers
16k views

Web api authentication techniques

We have a asp.net MVC web service framework for serving out xml/json for peoples Get requests but are struggling to figure out the best way (fast, easy, trivial for users coding with javascript or OO ...
19
votes
8answers
1k views

“Public APIs are forever: Only one chance to get it right”?

In an OS book I just read that, "Public APIs are forever: Only one chance to get it right". Is it true? Is it applicable only in APIs of Operating Systems or other APIs too? For example, will this be ...
15
votes
3answers
916 views

Does decoupling trump DRY in REST?

I am building a REST API to expose most of functionality of an existing Java API. Both APIs are for internal use within my organization; I do not have to design for external use. I have influence ...
13
votes
8answers
1k views

How do you remember numerous API? [duplicate]

There are lots of other APIs I need to use besides the Selenium test tool to be able to get tests working. Not using them for just one week and the mind has lost all of them. How is it possible to ...
13
votes
3answers
3k views

Joda Time vs Java Time

Although Joda is feature rich and more sophisticated than standard Java time, it may not always be the best thing to use. How do I decide if I should use Joda Time or Java Time in any Java code? Is ...
13
votes
3answers
14k views

How do web APIs work? [closed]

I have heard of many web APIs like that of Facebook, Twitter, etc., which helps third party access data and manipulate it. I would like to know how a web API works. What are the basics of a web API? ...
13
votes
5answers
3k views

Internal and external API architecture

The company I work for maintains a successful SaaS product that grew "organically" over the years. We are planning to expand the line with a suite of new products that will share data with the ...
13
votes
5answers
599 views

In API design, when to use/avoid ad hoc polymorphism?

Sue is designing a JavaScript library, Magician.js. Its linchpin is a function which pulls a Rabbit out of the argument passed. She knows its users may want to pull a rabbit out of a String, a ...
13
votes
2answers
7k views

How should an API use http basic authentication

When an API requires that a client authenticates to it, i've seen two different scenarios used and I am wondering which case I should use for my situation. Example 1. An API is offered by a company ...
12
votes
5answers
5k views

RESTFul: state changing actions

I'am planning to build RESTfull API but there are some architectural questions that are creating some problems in my head. Adding backend bussiness logic to clients is option that I would like to ...
11
votes
6answers
4k views

Are Java's public fields just a tragic historical design flaw at this point? [closed]

It seems to be Java orthodoxy at this point that one should basically never use public fields for object state. (I don't necessarily agree, but that's not relevant to my question.) Given that, would ...
11
votes
4answers
680 views

Using natural language grammar in fluent API

I'm tinkering with a query abstraction over WebSQL/Phonegap Database API, and I find myself both drawn to, and doubtful of, defining a fluent API that mimics the use of natural English language ...
11
votes
2answers
4k views

Trailing slash in RESTful API

I have been having a debate about what to do with a trailing slash in a RESTful API. Lets say I have a resource called dogs and subordinate resources for individual dogs. We can therefore do the ...
11
votes
6answers
959 views

How do you learn a language's standard framework/API/functionality?

I understand how to code. I know how to get around the basics of the languages I use regularly. I know how to write slightly-above-basic regular expressions, I can talk to databases, I can accept ...
10
votes
1answer
2k views

What ever happened to the Google AJAX Search API

I am looking to query the main Google search however all references including stackoveflow point to the Google AJAX Search API. The odd thing is that it does not seem to exist any more not even a ...
10
votes
1answer
472 views

How discrete should a RESTful API be?

I've never built a RESTful API before and I am wondering how discrete should it be? For example lets say I have a customer which has a name, address, phone number, email address, language, etc. Does ...
10
votes
1answer
1k views

Generate commercial license key for web service

Background I have a business question regarding web-based software licensing. A number of web sites offer software as a service for various APIs. A good example is Google's Custom Search API. The ...
10
votes
3answers
918 views

How to do external API testing (blackbox)

Assume you are using APIs from a vendor, how to make sure their API is working as expected? My main concern is sometimes the vendor pushed the changes to their code and break the API, we want to have ...
10
votes
4answers
1k views

Evolution of the Win32 API

Has the Windows 32 API changed much over time? Does the Charles Petzold book "Programming Windows, 5th Edition" from 1998 still contain relevant information, or is most of it obsolete/outdated? What ...
9
votes
6answers
488 views

Is it better to have one method that takes a bool as a parameter or two methods with different names? [duplicate]

I'm writing a factory class for a Selenium Web Driver and I came across a choice that I couldn't figure out which is cleaner. Having two methods with the same parameter. GetWebDriver(string browser) ...
9
votes
6answers
1k views

Why use services (REST/SOAP) instead of a library?

Let's say you're looking at breaking up your applications into services. Are there any good reasons to adopt a SOA approach vs. just creating a library API that can be loaded by the applications that ...
9
votes
4answers
583 views

Should I parse XML on the server or provide a proxy and let the browser parse it?

I need to interface with a 3rd party API. With this API I make a GET request from within the end user's browser and receive an XML response. This data is to be used in a browser based application ...
9
votes
4answers
803 views

How are undocumented functions discovered?

I've always wondered how do you find undocumented / private API ? Example the Apple undocumented / private API, Play Station, Windows Phone 7, Win32 Kernel, Windows API, hidden callback, etc... ...
9
votes
2answers
4k views

Implementing the command pattern in a RESTful API

I'm in the process of designing an HTTP API, hopefully making it as RESTful as possible. There are some actions which functionality spreads over a few resources, and sometime needs to be undone. I ...
8
votes
3answers
171 views

How to document experimental or incomplete APIs like @deprecated?

Is there a good term that is similar but different than "deprecate" to mean that a method or API is in the code base but should not be used because its implementation is not complete or will likely ...
8
votes
5answers
3k views

REST API concepts

I have three questions about REST API design that I'm hoping someone can shed some light on. I've searched relentlessly for many hours but haven't found answers to my questions anywhere (maybe I just ...
8
votes
2answers
262 views

event listener pattern in api - what should adding the same listener twice do?

In designing an API that provides an event listening interface, it seems there are two conflicting ways of treating calls to add/remove listeners: Multiple calls to addListener will only add a ...
8
votes
1answer
617 views

What API design for storing generic data in a more specific format?

for In the project I am working on we send messages about widgets over message queues, serializing them onto the queues as XML. The XML schema contains tags for properties that are common to all types ...
7
votes
6answers
391 views

What core principles would you want in a library?

Theres talk about what syntax and feature you like in a programming language; i'll now ask what core principles or feature would you like in a library in your favorite (or any) language? An example ...
7
votes
2answers
2k views

What does it mean to “expose” something?

So I am working on creating a Google App Engine Application, and I've come across the term "expose" a number of times, e.g. "your first app can expose objects using an HTTP based API" and "expose this ...
7
votes
8answers
821 views

Examples of Java APIs that demand an action sequence

As part of a research I'm working on, I'm looking for public APIs that only work correctly when you apply a certain sequence of actions on them. For example, the java.nio.channels.SocketChannel ...
7
votes
4answers
793 views

Building a web application that is almost completely rendered by Javascript, while back end only delivers Json. Do or don't?

As a programmer, and taking into account the overall "funness" of the process, I'm tempted to start a project in Sinatra where the back end's sole concern is the logic, and returning a Json API, and ...