Testing & Troubleshooting

The last part of the series is about testing and troubleshooting. And here is where I’ve drawn the most inspiration from event sourcing.

In the first part of the series, I mentioned that I have a LoggingActor that intercepts every event sent on the stream and puts a message on the log. I also send the log message to Firebase Crashlytics to get a narrative up to a potential crash.

Let’s first have a look at an example narrative to get a better understanding of the benefits it gives. …


Extensions, helpers & tips.

In the first part, I talked generally about the problems I see with dependency injection frameworks for Android today. I also explained a reactive approach to Android architecture containing a central stream to pass messages on between the business logic and the view logic parts of an application.

First I just want to mention that I wrote an update to the first part where I recommend that you use SharedFlow instead of BroadcastChannel.
I explain it further in this article.

This reactive approach is excellent for some use cases but can feel overly complex in others. For example, having an…


An Actor-based Architecture Approach

Android architecture has come a long way in standards and best practices, especially near the UI. I don’t see many apps that don’t use ViewModels, Views, and LiveData to simplify the app. But one step further from the UI, where the business logic resides, there are almost as many implementations as applications.

Still, there seems to be a general idea that dependency injection should be the golden way, but I don’t see it, not yet at least. The popular frameworks have been around for a long time and haven’t convinced so far. Despite the shortcomings of the frameworks, I do…


An auto-backup rabbit whole.

Today I got forced to learn a bit about auto backup. And I always enjoy learning. But this time, I would’ve appreciated more concrete answers. Hopefully, my findings will help someone else faster.

I created a new android application from Android Studio, “No Activity”-template. Just after creation, I ran the script ./gradlew lint on it; 1 warning.

On SDK version 23 and up, your app data will be automatically backed up and restored on app install. Consider adding the attribute android:fullBackupContent to specify an @xml resource which configures which files to backup. More info: https://developer.android.com/training/backup/autosyncapi.html

The lint warning is actually…


Communication essentials for Coroutines

In the last article, we went through what a Channel is and the four types of Channels. Let’s get more practical and see when, how, and different ways of using Channels.

Not Rx

First things first, we need to establish the difference from Rx so that we can focus on Channels rather than a replacement for Rx. The most important thing to remember is that a Channel, by nature, is not broadcasting its values. Once a receiver has acquired some value from the Channel, it is removed from the Channel. …


Communication essentials for Coroutines

Using coroutines in Kotlin comes with a few struggles since the way of writing your code, and reasoning about asynchronicity is somewhat different from what we are used to.

The construct that helped me get my head around it all was the Channel. If you’ve worked with Rx or similar before, you should also be able to draw parallels and have a smoother transition to coroutines. Also, if you understand Channels, the Flow construct will be easier to grasp as well.

What is a Channel?

As described in the API reference, a channel is a synchronization primitive, a way of communicating streams of values…


First impressions

I’ve been around Android development for so long now that my early app distributions were to root the device that wanted it installed and manually plug in the cable to install it via command line. Not the best experience nor the reach you wanted. How do you explain to someone who joined a beta program, that they have to root their device? Thus throw away all their guarantees from the manufacturer and maybe even brick their phones.

Then came other app stores where you could distribute the apps. Later you could even do dropbox links given that your user had…


In 2021, the sun will set over DST in Europe

As a programmer, you’ve probably faced the time problem, be it displaying the time of a chat message, when an article is published, or updated when you try to synchronize content from different sources ordered by time, or implementing cache logic.

In 2021, Europe will remove daylight saving time (a.k.a. DST). There will be no switching between time zones twice a year like we’re used to. For example, in Europe, two timezones are CET (Central European Time) and CEST (Central European Summer Time) that represent the same location but during different periods of the year. After 2021 there will only…


One of the use cases why an inline class is useful.

A while back, before Kotlin introduced inline classes, I was building a small widget that needed to convert Fahrenheit to Celsius and vice versa.

Since both are represented by a Double, I thought I’d use type aliases to separate them. I thought it was a cool idea, so I fired away and declared my type aliases and built functions to convert them as well.

typealias Fahrenheit = Double
typealias Celsius = Double
fun convert(value: Fahrenheit): Celsius = TODO()
fun convert(value: Celsius): Fahrenheit = TODO()

The first problem, you can’t do this. The Kotlin compiler can’t differentiate the two signatures from…

Bob Dahlberg

Lead Developer at Qvik, Coach, Agile Thinker, GDG Lead.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store