SDKs and APIs – All you need to know to make an informed decision

SDKs and APIs - All you need to know

Building software in the current world requires high-speed development to meet ever-changing business needs. Products and services are delivered incrementally in Agile mode. 

To meet speed and quality requirements a development team will need to identify the following:

  1. Development tools and frameworks that ensure standardization.
  2. Ready made solutions that can be integrated directly or customized to serve their needs.

Thankfully modern development approaches have ready-to-use SDKs and APIs to meet these challenges. Instead of wasting time and resources on researching, developing, and testing, teams can use a plethora of APIs and SDKs with extensive community support.

An SDK is a full-fledged installable library, while APIs are services exposed by a third party or another service, to be communicated with. Both take away the development effort of a module or feature that you might not be ready with.  Depending on the scenario a developer or team will either need an SDK or just an API. Making an informed decision on when to use one over the other is crucial to successful software development. 

To understand this, let us take an example in which we want to build a native health tracking app. The app will have the following features:

  1. Social authentication through Google or Facebook accounts.
  2. Location tracking to figure out distance covered from point A to B as per the user’s activity. It could be cycling or walking.
  3. BMI calculator.
  4. Diet options.

The list can continue, but we do not want to digress from our main intent of understanding SDKs and APIs.

The first thing to consider while building a native mobile app is that there needs to be an Android and an iOS version to serve the majority of users. Whether one should go in for a native or a hybrid app or build the 2 variants using a Cross-Platform approach requires a separate discussion in itself. The starting point for it could be the skills available in-house.

Android app and social authentication implementation

For our scope, let’s just consider the Android app. The official language for building Android apps is Java. Kotlin also has become an official language for Android development and is heavily promoted by Google. C, C++ runs natively on the phone. Then there is LUA which is not supported natively and requires an Android SDK. You can even use C#  depending on your team’s core competency. This will require either Xamarin with Visual studio or Unity. 

We are going to choose Java here.

The best way to get started for a Java developer is to install Android Studio which is an IDE that automatically downloads the Android SDK and emulator.  The Android SDK is a complete set of development, debugging, testing, and build tools, APIs, and documentation. Using the SDK you can generate APKs that can be deployed to different Android-supported devices. The developer just focuses on the language of his choice based on what is supported by the SDK and uses standard code and framework to get the app up and running. 

The next feature to be built is single-sign-on into the app, using a social account. Both Google and Facebook provide client or server-side SDKs to hide the complexity of the actual implementation and enable the integration through popular languages. The developer just rides on the authentication provided by Facebook and Google. Additionally, the user also grants the app the permission to access information or perform operations on either platform based on our need. In our case, we will have to use the Android SDK provided by Facebook and Google.

SDK Framework - SDKs and APIs

To sum up, the Android SDK enables the following:

  1. Enables development of the Android app using a language of our choice, Java.
  2. Provides APIs to access location, UI, camera and other native features. 
  3. Enables localization of the app for different languages through the SDK’s framework if required.
  4. The Java code is compiled to an  Android application package along with the required libraries of the SDK

Hence for our health tracking app, we can use the Android SDK for social authentication

Unsure of which SDK Framework to use? Send in your requirement and we will be happy to assist you!

Location Tracking Functionality

One of the key features of the app we are trying to build here is to figure out the distance walked or cycled by the user. We can take the route of custom implementation by spending a couple of days or weeks to come up with an algorithm, implementing and finally testing it. A better approach would be to use an out-of-the-box solution such as Google Maps and save on SDLC time and effort.  Google provides both SDK and APIs related to Maps and distance. In our case, we do not really need the entire Google MAP SDK. We can use just the relevant APIs such as the Distance Matrix API.  It gives you the distance and time between one or more endpoints. 

Let’s consider the Javascript implementation of the distance matrix API. The end-point provided looks like this:

https://maps.googleapis.com/maps/api/distancematrix/outputFormat?parameters

Based on the above URL we can glean that an API comprises of the following –

  1. Protocol – SOAP, REST or GraphQL. In our case it is REST. SOAP is the oldest mode of interaction with heavy schemas and data. REST is an architectural style relying on HTTPs GET, POST,PUT and DELETE operations. GraphQL is a query language promoted by Facebook which solves the problem of under-fetching or over-fetching by REST.
  2. URL – as provided by the service provider.
  3. Request Parameters – Either all parameters are mandatory or some are optional. Any service exposing APIs will share the parameters and their structure. In our case for instance – destinations and  origins are required parameters. Mode (bicycling or walking) is an optional parameter. 
  4. API Key – We will need to pass a unique API key that points to our application using the service for authentication and authorization.
  5. Response – The output is either JSON or XML.

An API (Application Programming Interface) enables easy and seamless data transfer between a client application and the server providing the service. There is no installation required, unlike an SDK. The API logic is completely abstracted by the service provider from the client. APIs contribute to a loosely coupled, flexible architecture. Since the API code lies on the server, it’s maintained by the provider. Because of this dependency, we need to ensure that we choose a reliable provider and also keep an eye out for newer versions.

Hence for our health tracking app, we can use the Google Map API for location tracking.

BMI calculator and diet options implementation

This would be either a custom implementation, an API, or SDK. If it’s not available readily as an API or SDK and is required in a number of different health services or products the organization wants to provide, it would be best to expose it as an API for current and future use. 

Diet options clearly are a custom implementation in our scenario.

Differences between SDKs and APIs

APISDK
An API is used to provide a feature by running on a third-party system in a request-response mode.An SDK provides all the tools, libraries, APIs, and documentation necessary to build the application or feature.
APIs run on separate servers (internal or 3rd party) and hence have a continued dependency on the service for reliable operation.SDKs typically run on the same environment and hence have no interdependencies. However, they use the processing power of the existing environment of the application being built.
This just requires a SOAP/REST/GraphQL call to the server end-point with request parameters defined as per the API documentation. This is available in languages supported by the provider which is mostly based on what can run in the environment expected and the popularity of the language. 
For instance, Java, NodeJS, Python, GO, PHP are the usual languages popular with the developer community.
No installation is required. It requires installation and is therefore bulky. Any upgrades will need to be handled at our end. Some SDKs also allow customizations as per our needs.

In a scenario where just a few APIs are required from the entire stack provided by the SDK and these APIs can be independently run, it’s better to opt for the APIs alone.
Error handling is left to the application based on what is thrown back by the server.SDKs lean on the language’s error handling mechanism besides what the server platform returns. Therefore error handling is handled in a more effective way.
Examples – Map Apis, Payment Apis, AdMob API provided by Google.Examples – JAVA SDK, Android SDK, Facebook’s Single Sign-on SDK.

While SDKs are a superset of APIs, used appropriately, they both have many advantages over custom development. 

Advantages of using SDKs and APIs

  1. Fast and easy adoption – A few lines of code and your feature is ready.  The developer can focus on the core business functionalities of the application instead of re-inventing the wheel or working on something that is not our core area of expertise.
  2. Saves time and effort – Ready to use and can be directly plugged into, thereby shortening development cycle.
  3. Language – In the case of SDKs, they usually support all the popular languages that the implementation needs. For APIs you just have to ensure the communication protocol and parameters are as per the requirements.
  4. Support -APIs and SDKs ensure best practices, provide robustness and have community support.
  5. Documentation – APIs and SDKs have good documentation for developers to understand and use. No expertise required other than knowing the language to be implemented in. 
  6. Updated – Newer features keep getting added to the stack by way of versions which the developer if required needs to just update. Mostly backward compatibility is already handled by the service provider.

Disadvantages of using APIs and SDKs

To summarize, whether it’s an API or SDK, it’s better to follow the reviews of the community before making a selection. Things to look out for are known bugs, limitations, and cost.

SDKs and APIs - disadvantages

Trigent provides a number of ready-to-use SDKs and APIs for many domains such as mobile app development, SCM workflows, Logistics, AR/VR development services, enabling you to focus on your core expertise and saving you a lot of time and effort in your development cycles. To know more, please contact us

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *