What is an SDK?
SDKs contain the tools and instructions for developers to build applications within a standardized operating system, environment, or development process. For example, to build Android mobile apps, a developer would get the Android SDK, to build ios mobile apps, the developer would get the ios SDK. An SDK contains a standard set of tools for a specific platform or use case, similar to buying Lego building blocks to build the model depicted on the box.
What's in an SDK?
- Code Libraries - This is raw code that software developers usually need to download and use. Including the libraries saves time, and means the included code will play nicely with itself.
- Application programming interfaces (APIs): These are interfaces that allow the application to connect easily to other web applications via the API interface.
- Integrated development environment (IDE): This is the interface through which developers do their programming. It includes a compiler, which translates the high-level programming language of the SDK's source code into a lower-level language that can be used to build applications.
- Documentation and code samples: This tells developers how to use the code, and includes examples.
- A debugger: Language-specific debugging automatically corrects minor errors.
What is an API?
An API, or Application Programming Interface, is a set of rules that define how computers and applications can communicate with each other. If you recall the old switchboards that operators used to field phone calls to their destinations, APIs are a little like that. A client makes a request to an API at an endpoint which it has access to. The API validates the request and passes the request to the destination server or program. The server sends a response back, first through the API, which then transfers it back to the client.
What's in an API?
At the heart of RESTful APIs is the contract between client and server. This contract defines what the API will do and what kind of requests and responses it will issue. If you call the API, you must do so in a way that it understands, and you must be able to accept its responses, also. An example of an API contract can be seen here. You can see the APIs URLs, verbs, HTTP responses, and contract statuses- all the rules of interacting with this API are defined in the contract. For more on contracts, check out the Open API spec.
SDK vs API
An SDK may contain APIs, but APIs do not contain SDKs. A developer who wants to develop a new application for a specific platform would be best served with that platform's SDK. If they already have an application that just needs a certain functionality- for example, an IP geolocation feature- an API would serve their needs.
How do SDKs and API relate? Well, consider what service SDKs provide to programmers. SDKs provide the building blocks and tools to construct a software product, and as web developers know, software isn't built in isolation. SDKs allow programmers to communicate with resources via the APIs, drawing in functions as they are needed without having to build everything from scratch. SDK APIs also ensure developers are receiving up-to-date resources and employing them correctly within their environment.
SDK vs API Example
A recent example of SDKs and APIs is the new Android Game Developer Kit, or AGDK. This is a SDK specially tooled for- you guessed it- Android game development. It includes:
- A code extension for coding Android apps in C++
- Game engine integrations for Godot, Unity, Unreal, etc.
- Game engine plug-ins, for things like Unity engine, performance tuning, and virtual reality
- C/C++ game libraries
- GPU Optimization tools
The AGDK includes other tools, but you can see in this example what this SDK is all about: encouraging game development in Android by providing developers the tools they might need. In the AGDK documentation there is information on the `GameTextInput` REST API. This API displays the soft keyboard, sets or gets the currently-edited text, and receives notifications when the text is changed, all without the developer having to write a keyboard function from scratch. Actually using this API is outside the scope of this article, but as you've seen, the `GameTextInput` API is called from the SDK if the developer decides its function would solve a problem for their Android application. The API exists only as a contract and interface for the SDK to access resources.
SDKs include APIs in their libraries for added functionality beyond the included development tools, while still keeping developers inside of the development environment. APIs provide functions without developers having to write code from scratch to solve common problems. This helps companies extend their reach with developers, so an SDK is both a technical product and a marketing product, part of the developer experience, or DX. The more developers happily building games in Android, the happier Google will be. Devkits provide API solutions to make developers' lives easier on their platform, which will persuade developers to adopt the technology.