Update Note: This tutorial has been updated to Kotlin by Joe Howard. The original tutorial was written by Matt Luedke.
[…]
This article also assumes you’re familiar with the basics of Android development. If you’re completely new to Kotlin, XML or Android Studio, you should take a look at the Beginning Android Development Series and Kotlin For Android: An Introduction before you start.
[…]
In the sections that follow, you’ll cover the following patterns from each category and see how they apply to Android:
[…]
In Android, the Builder pattern appears when using objects like AlertDialog.Builder:
[…]
Behind the scenes, the Kotlin object is backed by an INSTANCE static field, so if you need to use a Kotlin object from Java code, you modify the call as follows:
[…]
Greenrobot’s EventBus is a popular Android framework that supports this pattern in the following manner:
[…]
The RxAndroid framework (aka Reactive Android) will let you implement this pattern throughout your app:
[…]
Subscriber objects will listen for these values and react to them as they arrive. For example, you can open a subscription when you make an API call, listen for the response from the server, and react accordingly.
[…]
You may have to do some drawing in Kotlin from time to time, in which case it will help to separate the drawing operations from your activity and fragment classes.
[…]
The original Clean Architecture definition is here, and many examples can be found on Clean Architecture for Android, including Architecting Android…The evolution.
[…]
I recommend checking out timeless classics such as Design Patterns by the “Gang of Four.” Compared to Material Design or Android Wear, this book might be considered “ancient”, but documents many useful design patterns that predate Android itself !
[…]