On our latest article, what we did was creating a Dagger component about almost all of our features and provided a ViewModel(Factory) for every Fragment we had inside a module. As said, this is a little too much work for Dagger, the programmer and each feature. It’s a total overkill of using Dagger actually, we could have stuck to a manual DI instead, but I required you to be patient.
This is part 2 of a series of articles about modularizing Android app. If you haven’t yet read the first article, you may find it here. On our first article we just moved some classes outside the application and applied as an independent module. But what if we have dependencies pulled from the application level? This could be a small challenge. First of all, we want to clarify on how are we going to modularize the app.
Inspired by a Martin Fowlers post about Micro Frontends, I decided to break my monolithic app into a modular app. I tried to read a little more about breaking monolithic apps in Android, and as far as I got, I felt confident to share my experience with you. This will be some series of blog posts where we actually try to break a simple app into a modularized Android app.
There is no doubt that people are getting away from GSON and I agree with those reasons too. The only advantage GSON has over other parsing libraries is that it takes a really short amount of time to set up. Furthermore, the most important thing is that Moshi is embracing Kotlin support. First let’s implement the dependency: implementation("com.squareup.moshi:moshi:1.8.0") It’s not a struggle to migrate to Moshi. It’s really Gson look-a-like.
The coroutines API has already brought some innovation in the Android and Kotlin world. I always loved the idea of keeping it as simple as we all can. There is a saying around here that “Whoever talks to much, makes too much mistakes” and I see this a little bit related to Java’s verbosity and also in the world of concurrency. It’s said over and over again that concurrency is not simple and I couldn’t agree more: You have to care about context, jobs running in parallel, cancelation, returning values etc.
My last article covered some simple example about Room and RxJava instrumentation testing code. Coroutines also have great support in unit testing even though todays topic has nothing to do with it. What I mean is that we are not going to cover runBlockingTest this time. Android doesn’t support that (correct me if I’m wrong please) yet. However, I could schedule a topic about that because it really makes me excited.