Sunday, April 19, 2020

Mobile Development Is All Edge Cases


I've been a professional software developer since '98, that's 22 years of doing this stuff.  Most of my career has been in embedded development, but the field is pretty broad, I'm not a guy that's coding on 8-bit baby processors but rather fully capable 32-bit Posix-based operating systems, a couple of gigs of memory and peripherals.  Even so, mobile development (that on phones, tablets, or IOT) is arguably more complicated.

The complexity can be misleading and under-appreciated, partly because the misconception "It's just Java, you know Java?", partly because the Android libraries manage a good deal of the complexity, and partly because many true complexities are simply overlooked.  Let's just peek at the complexities of mobile development and hopefully you'll leave with a new perspective.

Multi-Applications

Unlike most embedded devices, phones/tablets have a never-ending list of applications that can be installed, run, uninstalled and such.  The user may choose to launch one, many or all applications at any given time.  Typical embedded devices have a fixed installation, dedicated purpose and go through a heavy quality assurance procedure.

Resource Reclaimation

Mobile applications are contending for device resources with all other applications.  The applications are independent and isolated from one another, but one complication that impacts each app is the possibility of the operating system terminating or restarting your app to preserve the resources for a contending app.  In other words, a properly developed app should gracefully address it being terminated at any time in order to reclaim the apps resources and give them to another.  This is the whole purpose of the Activity States, the appropriate handlers and a proper app should consider the impacts of it being terminated unexpectedly at any time, doing anything.

Network Connectivity

Dealing with wireless communication itself is a extremely complicated problem in itself.  A common misconception is that "with 4G connectivity is everywhere".  Sure, but unlike a fixed-line network connection, wireless signals come and go, especially when you are in motion.  Additionally, the type of network connection may change, yet still have a network connection.  This can manifest itself as a brief, or perhaps not brief, disruption of service.  The app could hang a bit, or worse simply crash.  If you want to observe an example of this, go into your garage, connect to your home network, start playing YouTube, then drive away.  The app will need to manage a network connectivity exchange from wifi to 4G, hopefully seamlessly; but don't count on it.  Managing this in the process of a network exchange can be a bugger.

Abrupt Termination

The operating system can clobber your app to reclaim resources, as can the user.  At any moment, regardless of what your app is currently doing, the user can simply pull-the-plug.


It's all edge cases, you simply can't rely on anything for a robust application.  You can ignore them, and your app can not manage them properly and honestly....you may get away with it.  Simply ignoring them however doesn't make them go away and if you're looking to develop a 'perfect app', these are the types of complications you need to consider and address.  You're standing on a stool and at any opportunity the user, operating system, resources can be abruptly kicked out from under you.  Handle every kick, or be prepared for a fall.

No comments:

Post a Comment