The Five Elements Of Software Engineering For Mobile (Part 5)

Software Engineering for MobileThis is the fifth part of our series about the five elements of software engineering for mobile. Part one was about the main differences and challenges of software engineering for mobile vs “conventional” software engineering, part two was about making the right technical platform choices, part three was about getting the UX right and part four was about choosing the right methodologies.

This blog post series is based on a keynote talk to computing students at the Imperial College during the kick-off event for their summer group projects, aimed at the development of an innovative web or mobile-based app. The talk should help the students getting a more holistic view about software engineering for mobile and highlight the following five key elements:

  1. Make the right technical platform choice for your context (Part 2)
  2. Get the UX right (Part 3)
  3. Choose the right methodologies in the areas of building a business, customer development and product development (Part 4)
  4. Enrich the functionality of your app by integrating Internet-based APIs (this part)
  5. Leverage the power of tools (rather than reinventing the wheel) (Part 6)

In this part I cover the fourth element “Enriching the app functionality via Internet-based APIs” in more detail. We will publish another part every week, so make sure to check back soon.

 

Key element 4:

Enrich the functionality of your app by integrating Internet-based APIs

 

3scale APIAn API is a specification that allows (controlled) access to a certain functionality or resource. Generally, it is differentiated between device and APIs that are accessed via some form of communications network (the Internet in most cases). A device API is provided through libraries on a device’s platform (operating system) and allows access to device specific features such as hardware like compass or GPS sensors, or services like phone book or calendar. Internet-based APIs on the other hand allow access to services, content or resources from third parties via the Internet. This allows the developer to enrich a mobile app with a lot of additional functionality. In fact already in 2012, 77 percent of the top-50 free and top-50 paid apps were connected to some sort of third party or backend services via Internet-based APIs — only 23 percent were completely stand-alone. ProgrammableWeb is on online directory that lists and tracks the number of such APIs and they report currently 11,404 registered APIs with exponential growth. The most popular API categories include social, shopping, mapping, telephony, music, search or photo and video. Among the most popular API providers listed are Google Maps, Twitter, YouTube, Flickr, Amazon, and Twilio.

There are various technologies and protocols used to implement Internet-based APIs. Most of these APIs (91% according to ProgrammableWeb) use Web technologies; so in most discussions Internet-based APIs are actually referred to as “Web APIs”. In fact, 70% of Internet-based APIs follow the Representational State Transfer (REST) architectural style, which is entirely based on Web standards and technologies such as HTTP, URL, XML or JSON.

There are many resources on the Web with excellent introductions and tutorials about REST including one on the APICodex specifically on REST. In my talk, I gave a brief overview and showed a simple example how a RESTful API can be called from an Android application. In summary, REST is a stateless client/server communication protocol that is platform or operating system independent as it is based on URL. So, the implementation of the URL invocation on a particular platform depends on the libraries provided by that platform. REST supports all CRUD operations via the HTTP verbs: PUT, GET, POST, and DELETE.

I showed an example where an imaginary email verification Web API is called (this example is loosely based on this tutorial) on Android. For this, I used a private class which executes the RESTful API call in a separate thread in order not to impact the UI thread. I used the URL and HttpURLConnection classes provided by the Android platform to execute the call against the imaginary email verification API endpoint. The response from this endpoint is written into a BufferedInputStream object. This object can then be used to further process the response.

In the talk I also explained the idea of software development kits (SDK), which are native wrappers around a Web API. There are many pros and cons of related to SDKs as recently discussed at API Strategy and Practice (APIStrat) conference in Amsterdam, or here. Basically, the benefit of an SDK for a developer is that the adoption of an API can be much simpler and quicker, provided the SDK is well defined and there are no complicated sign-up processes required. The simplicity comes from native classes and methods that abstract from potentially complex client/server communications and data formats all based on Web technologies.

 

In this part, I discussed the benefits of Web APIs and how they can be used to enrich the functionalities of mobile apps. In the next part of our series The Five Elements Of Software Engineering For Mobile (Part 6) I will cover the power of tools.