7 deadly mistakes in mobile app development startups must avoid! (6 of 7)
Part 6 of our 7 part series where we look at most common myths about mobile app development. Trust the experts.
Myth #6: Our existing backend can support mobile apps
REALITY: Most likely your backend is not designed for mobile. You will need to change or rewrite that.
Most companies are not used to building the backend that caters to the needs of mobile app development correctly. You need the right API design and proper implementation of the same, else your app will be crushed in the real world.
One of our large clients had a good working website. They wanted us to use their existing SOAP services to talk to the backend. Soon we realized that some calls were returning upwards of 3 MB data per call. That’s a huge amount of data fetch in the mobile apps even on a wifi with some of the most powerful smartphones out there. The user experience was abysmal considering they had to wait 20 seconds to load a screen. Compare that to 0.2 seconds most of our API calls require.
When designing for mobile, you need to consider these:
Low latency: Your API needs to have a really quick response time and low latency when dealing with mobile devices. The lower the latency on each API call, the snappier your app will feel. To support a large number of users, caching and other techniques are required to be built right inside the API. Avoid multiple database hits and re-authentication per API call by leveraging auth tokens based API design.
Data Size: To give your users best mobile experience, send the minimum amount of data in an API. Good APIs use compression for data exchange and return 2k to 20k of maximum data per API call. Further the preferred data exchange format is JSON to reduce payload size as compared to XML. For images, you will need to store images preprocessed in multiple sizes so that listing API returns only smaller sized thumbnails. Usually 3 sizes are preferred, small thumbnail, large thumbnail and regular sized image (still reduced for mobile performance).
API design customized to App screens: Design your APIs so that each screen is loading with a maximum of one API call per screen. Although this requires tighter coupling between the client and the server, but this alone can make for a very superior mobile experience.If multiple data is required, design APIs so as to return multiple data blocks within the same API call. While this API design does not caters to other apps like desktop, your reduced server load with less number of API calls and increasing mobile user base will pay for itself in a short time.
Paging: In mobile API, never return a large amount of data. Be careful when designing for data that is currently small but will increase eventually. Listing APIs should return data with input page size and page number so mobile clients can control what they need.
API Versioning: An important aspect of API design needs to be versioning of the API so that when new features are implemented, it does not breaks old mobile clients that are still using the older API. API versioning prevents this by either specifying a different API route or using version as a parameter in request or headers.