Android Architecture Components by Rebecca Franks

Nnubia Ogbuefi
Nur: The She Code Africa Blog
5 min readApr 15, 2020
SCATweetChat with Rebecca Franks

SCA: Welcome to this series of #SCATweetChat We’ll be discussing the topic “Android Architecture Components” Our guest Rebecca Franks @riggaroo (Riggaroo) is available to answer any questions you have. We’re excited to have her for a chat this April. Please introduce yourself. Tell us about you and the amazing work that you do.

Riggaroo: Hi! I’m Rebecca, from Jozi, South Africa 🇿🇦 I’m an Android Developer @GoDaddy building the @Over Android App, which is a graphic design app for mobile 👩‍💻. I am also a @GoogleDevExpert for Android. I love sharing my knowledge and helping others learn:yellow_heart:

SCA: Before we dive into today’s topic, can you please share more about your experience in Tech and also your journey to being a #GoogleDeveloperExpert for Android?

Riggaroo: I have been professionally developing apps for ~8 years. Some of the other apps I’ve worked on before @Over include the @DStv. Now Android App, @BookDash app and many other smaller ones.
My journey to becoming a Google Developer Expert (GDE) started in 2015, I learnt about the program after talking with the Google team. I was already writing posts and speaking at events. Hearing about the program got me more excited about expanding my reach. I put in a lot of energy into creating Android Development content.
In 2016, I was awarded the @GoogleDevExpert badge. Since then, I’ve met so many incredible developers, helped others learn new concepts & learned so much myself. I’m immensely grateful for it :yellow_heart:

SCA: To get things kicking, how would you describe Android architecture in lay terms? Also, can you elaborate on components for Android Architecture?

Riggaroo: Android Architecture Components is a collection of libraries provided by Google to make your apps more maintainable & testable, useful for following cleaner architecture. There are components such as ViewModel, Room, LiveData, etc.
Architecture refers to how you structure your code for reuse and separation of logical components. It is generally referring to a pattern that you might apply to your app and follow for building new components.
Architecture, in general, enables us to build better apps. If done correctly, it ensures your code is cleaner, has better separation of concerns & is easier to test. With a proper arch, your code generally has fewer bugs & is easier to follow for new developers.

SCA: Of the many components, what would you consider foundational/most important ones while building out your project?

Riggaroo: I would say ViewModel is the most important/useful component. It allows you to separate business logic outside of your views. It takes care of storing your data whilst respecting the lifecycle of a view, which has typically been difficult to manage in the past.

SCA: How do you ensure a great mobile app user experience while working with multiple components?

Riggaroo: Use the AAC that makes sense for your app, don’t use them just because they exist. Great UX depends heavily on the app, some apps it makes sense to use WorkManager to get background data & store in Room, whilst others it makes more sense to not show cached data.

SCA: Does clean architecture exist in Android development? If yes, what does the term mean?

Riggaroo: Clean architecture does exist in #AndroidDev. The terms mean that you have an app that conforms to a certain pattern, which makes it easier to work with, maintain and test. Your code is neatly separated into different classes and components.
You can accomplish clean architecture in many different ways on Android, if you haven’t implemented an architecture, I’d recommend reading the Guide to App Architecture, it provides a great starting point.
If you have more experience with Android, you might find that the guide doesn’t cover your use case or where you want to go with your architecture. In that case, I’d recommend researching more from the community with regards to different design patterns such as MVI.

SCA: Could you give a very brief intro into working/building with Kotlin coroutines for components? What? Why? How?

Riggaroo: Coroutines make this a lot easier & neater to work with. Android ViewModels have built-in support for coroutines, by providing access to different scopes that can automatically cancel in-progress operations if the ViewModel is destroyed. I’d recommend reading more about coroutines from the official Kotlin website and learning more about how you can use them with architecture components.

SCA: Can you please share some of your favourite guidelines/best practices for working with components in Android Architecture?

Riggaroo: I would say follow the guidelines and articles from the Android Team from the docs and Medium. I would also follow some of the people who speak about the components regularly Florina Muntenescu and Manuel Vivo.

SCA: Any helpful links or learning resources for people to get started or become better with on this?

Riggaroo: The official docs and medium account mentioned earlier. As well as there are quite a few YouTube videos from past Google I/O’s where the components were introduced.

SCA: Let the questions roll in!!! I will be answering questions now. Don’t forget to use the hashtag

Zennymorh: Can you talk a bit about data binding? Why is kotlin ktx not enough?

Riggaroo: I haven’t used data binding extensively in the past. Kotlin Android Extensions have a few drawbacks with how they work under the hood. View Binding, however, seems to be the new way to go for resolving views.

EA: What’s the role of dependency injection in an Android app architecture? Is it that important? Can I build a standard Android application without implementing DI?

Riggaroo: You can build an app without DI on Android, however, I wouldn’t recommend doing so for large apps or anything further than a small sample app. DI is important because it enforces the concept of clean separation of concerns and easier testing.
Whether or not you do it manually or with a framework, doesn’t matter as it will likely have a similar outcome. I would recommend using a framework like Dagger as it helps manage complex dependencies, especially in larger-scale apps that have many components.
It does many other complex things that help optimize your DI and memory usage, so building up what already exists could be difficult. But maybe a good starting point is implementing basic DI yourself, understanding how it all works and why. Then moving onto a framework.

SCA: It’s been exciting, enlightening and fun. Thank you for your time and immense knowledge poured into this. Insightful! Thank you to everyone who joined in the chat. Keep tabs on our page @SheCodeAfrica to stay in the loop.

--

--