18 days ago I took a challenge for myself that focuses on learning and building in public. It’s time to reflect on what I’ve achieved.
In this post, I decided not to beat around the bush and quickly summarize what I did during the last 9 days and go on.
My week consists of 9 days now 😁, but that’s OK because I planned the challenge to last 2 months, not 8 weeks. It started on the 4th of August and will finish on the 4th of October, so I have 61 days in fact. Is it a legitimate move? 🤔 Should be.
Quick summary
Anyway, during this week I focused on managing state in Android. It’s important because otherwise, we lose user’s input when they turn the screen, switch to dark/light mode, etc. The same happens when the system kills the app’s process to save memory.
That’s not as easy as it looks! Using remember { mutableStateOf() }
is not enough, unfortunately.
We also have side effects — code that goes out of the scope of a composable function. Philipp Lackner has a great video on this topic. But watching it is not enough for understanding. So I played around with it.
Also struggled to understand derivedStateOf
, but the answers to my question in Kotlin Slack and some research made it clear. In short, use derivedStateOf
only in rare cases. But in those rare cases, it’s extremely useful for performance.
Also learned new things about Gradle. Mainly that we can use different product flavors for minSdk
. So I refactored my project to use core library desugaring only when running on devices with Android versions less than 26.
Found out how to create a release APK version. And finally relieved when my app launched faster on release than on debug. That’s because I had thought there was a performance issue and I did smth wrong. 🤨
Learning resources
Here are the resources that helped me learn this.
Advanced state and side effects
- Advanced State and Side Effects in Jetpack Compose | Android Developers
- Should You Use Compose State or StateFlow in Your ViewModels?
- Full Guide to Jetpack Compose Effect Handlers
- My question in Kotlin Slack about derivedStateOf
-
Gabor explains how to create a state holder but one that can be saved in
SavedStateHandle
and thus will survive the process death — What is the best way to pass a default/initial value to a Jetpack Compose TextField?
Gradle
- Sorting and Reporting Your Dependencies with Gradle with Ed George, Android Worldwide
- Gradle for Beginners (Build Types, Product Flavors, Build Variants, Source Sets)
Progress
This week I decided to focus on learning. Although I added some features to my recent learning project, I didn’t work on my real app.
AFAIK, here are the main concepts that I need to know to build an MVP:
- Android basics
- Kotlin
- Jetpack Compose basics
- Advanced state, side effects, and Gradle ◀️
- Navigation and performance
- Advanced Kotlin, Coroutines, and Flow
- Databases and modularization
- Dependency injection
- Architecture (MVVM, MVI)
◀️ — Where I was in the past week
So I’m glad to increase this “Learn Android” bar by 5% 🎉
Make my app still remains at 5%. I used to feel bad about it, but in the past week, I realized something that ended that feeling. I’ll probably make a separate blog post about it.
Performance adjusted to the brand new 9-day week 🙃
My challenge
✔️ 5/6 tweets
✅ 1/1 article (this one)
VC’s Healthy Habits challenge
✔️ Programming: 45/48
☑️ Household: did at least 1 household chore 6 days a week
☑️ Physical activity: 6/6 times
☑️ Rest: had at least 1h each day
😱 Learn English: 14/42
☑️ Daily review: summarized what I did every day
Updates to the challenge
It’s great to start small and then improve over time. So here are my improvements to the challenge’s rules:
➕ New habit — Follow the schedule every day. I discovered that I am still out of sync with my defined schedule. So I tweaked it and added this habit. This is mainly to get up at 7 AM and close my eyes at 11:30–12:00 PM.
⬆️ Work 1h more each day. This is actually not a problem for me. I usually work more than planned because I love programming and can’t put it aside. My problem is to not forget about other activities and not take their time. But as I said, I changed my schedule and now it should be OK.
⬆️ 2 articles a week (or 9 days 😁). I have a lot of ideas, drafts, and notes, but can’t find time for writing.
Ending
I wrote this article for myself mainly. But if you read this far, thanks for being interested in me. 🤗
If you're learning Android and struggling with some of these topics, you can dm me on Twitter or email me (daniel.rendox@gmail.com) and we'll figure it out together.