Using domain exceptions in your app is an important step if you want to create abstractions over different 3rd party networking libraries like Retrofit or gRPC. Handling and mapping of these exceptions can quickly become a boilerplate that you and your colleagues have to think about and sooner or later you will probably forget to do it somewhere in your code. I want to explore how this task can be done automatically in a generic and clean way when using the Retrofit library. (more…)
Clean Architecture is a much-discussed topic in recent years not only in the Android community. You can find many articles about it and most of them are devoted to an explanation and implementation of the Dependency Rule, which is the basis of the Clean Architecture. Implementing the Dependency Rule is quite easy but it is also really easy to violate it and it can be really hard to uncover that on the code review. It would be possible to control it better using
package private visibility or divide app layers properly to separate modules. The problem is that we do not have
package private visibility in Kotlin and layer modularization does not have to be a good or preferred architecture for our app. But don’t worry! We can use help from the static code analysis tool called detekt and I am going to show you how in this article. I expect that you already know and understand Clean Architecture including the Dependency Rule. If you don’t, I recommend this great article from Mario Sanoguera de Lorenzo. (more…)
I’m planning on constantly updating and extending this post for the first couple of months that I’m working with Kotlin. I will write down the things that I like about Kotlin, the things I feel are missing or I don’t like, and the things I’m still not sure about. These things may even end up changing their “baskets,” as I’ll be gaining more experience with this language :).
Some time ago I decided to try Kotlin in production and a few weeks ago I started developing an application that is the one, the one with Kotlin under the hood. When I discovered Anko library I was amazed by its simplicity and advantages over standard xml approach.
Why not Java?
The programming world is constantly developing, and so are the programming languages. They tend to become outdated and often aren’t able to compete with modern languages that better suit the needs of the industry. Java has been working hard to keep-up with the introduction of multiple modern features in Java 8, but unfortunately it seems that Android developers won’t be able to use them in the near future (natively). (more…)