AsyncTask and the Mayfly
I was going to write this post exclusively on the AsyncTask loader in Android studio, but after reading a number of blog posts, YouTube comments and recalling a conversation I had at the Google Dev Group meeting a couple weeks ago, I think I want to touch on a slightly different subject; framework lifecycle and the hack’n’patch nature of the tech industry.
Multithreading is an important part of mobile development, more so than in a traditional computer program because of the limited RAM and internet connectivity. Moving network requests and other such tasks to a background thread allows for a more fluid and immersive experience. Using the AsyncTask loader is how Android was presented to me, so when I went to learn more on my own, that’s where I began my search. After watching a couple videos on the Android Developer YouTube channel and reading some posts on Stack Overflow, it seemed that while using AsyncTask isn’t that difficult, not many “professional developers” use it in a professional context. According to a number of users, most developers use multithreading libraries and dependency injectors like Needle and Dagger in their day-to-day activities. I don’t know about you, but trying to learn something while concurrently being told I will never use the skill I am trying to master is terribly demoralizing. I am going to have to trust that the folks over at Udacity and Google are asking me to learn this for a good reason. I suspect it is one of those things that every Android developer has to understand at a fundamental level, so that if a library or dependency injector is not longer supported, the developer can still use the basic AsyncTask loader.
I understand if this isn’t news to most professional developers, but this revelation comes as somewhat of a surprise to a newcomer like myself. For now, I think the best course of action is to stick with what my instructors tell me to learn, and if I find myself struggling in a personal project, learning a new framework isn’t the worst use of a free day.