Introduction A significant part of being a successful software developer is refining our workflows to optimize productivity. One method I’ve found incredibly useful is integrating Git hooks with static code analysis tools such as Detekt for my Android projects. The Role of Git Hooks and Detekt in Code Quality Before we dive into the actual…
Diventa un Android Dev
Dal 1 febbraio 2021, in collaborazione con CGM Consulting, partirà il mio corso di programmazione Android destinato a tutti coloro che si stanno avvicinando al mondo della programmazione mobile: https://bit.ly/corso-android-ivan-morgillo Anche se sei già un dev, c’è sempre la possibilità di aiutare qualche amico o amica interessati ad una carriera come Android Dev 😉 Il…
D’oh!! There is no copy method for Sealed Classes in Kotlin!
A few weeks ago we looked at one of my pain points of working with Kotlin Data Classes: nested copy and we improved on a basic Kotlin solution using a Lens. Today we look at another type of nesting: Sealed Classes nesting. When we wanted to create some sort of restricted hierarchy in Java we…
How to fix the pain of modifying Kotlin nested data classes
When Kotlin arrived a few years ago one of the selling points was immutability: In object-oriented and functional programming, an immutable object (unchangeable object) is an object whose state cannot be modified after it is created. https://en.wikipedia.org/wiki/Immutable_object This is very cool! Value objects are such a huge help when it comes to reasoning about code, safety and avoiding weird subtle misbehaviours due to “things…
IntelliJ IDEA / Android Studio Tricks: Surround With
In one of my previous posts I wrote about one of my favorite features of IntelliJ IDEA/AS: Live Templates. “Surround With” is a sort of LT’s cousin. When you want to wrap a piece of code with a specific snippet, you select the code and hit the “Surround With” shortcut. On Mac you can access…
IntelliJ IDEA / Android Studio Tricks: Live Templates
One of my favorite features of IDEA are Live Templates. To give you a bit of context, Live Templates are those things you see appearing when you start typing in IDEA 😂 OK OK, let’s be a bit more precise. If you are writing some Java code and you type foreach and then press TAB,…
Can I loop over a Kotlin Sealed Class?
As an Android developer, I constantly write API clients: 90% of all mobile apps fetch some JSON, parse it and show it in a list ¯\_(ツ)_/¯ To keep a clear separation between what’s coming from the network and what I want in my domain, I usually have a DTO and a Domain Model. DTO and…
Modules, modules everywhere
I have joined asanarebel.com as Senior Android developer at the beginning of February. Asana Rebel is a health and fitness app with workouts for different body and health goals, but all of them are yoga inspired. When I joined, the plan was to increase the team size and raise the code base overall quality, focusing…
Kotlin DSL Gradle files, multiple modules and shared variables
This doesn’t want to be a real article, but more a crash course about Kotlin DSL for Gradle. The crucial point is the possibility of migrating an existing project to the new Kotlin DSL for Gradle, in an incremental, modularized fashion. Below we have a pretty standard root project build.gradle file: https://gist.github.com/hamen/7fa25a3a7ad8452873051f7782c77db5 The parts that…
My week at Droidcon Zagreb and App Builders
Last week was quite intense for me. For the first time I had two conferences in two countries in 3 days. I’m definitely too old for this 😜 Droidcon Zagreb Droidcon Zagreb started like this: The moment they dropped us at the hotel, we got a bag full of gifts and candy! There were plenty of…