Sign in

Kotlin coding conventions denotes that we should prefer if for binary and when for three or more options.

If-else hell
If-else hell
If-else hell

Understanding Kotlin and Java if-else

Cascading If


Working with referential equality check, you would have stumbled upon the concept of IntegerCache. Let’s dig deep into this private static class.

In the example, Do you know why the referential check for 200 is false while the check for 127 is true?
If you know the reason, then you can skip the below article.

IntegerCache:

To improve performace and to save Memory, IntegerCache was introduced in Java 5.

“Integer cache support the object identity semantics of autoboxing for values between -128 to 127 as required by Java Language Specification”


Android’s <activity-alias> tag is one of the most unused tags in the android manifest. The existence and benefits of it are unknown to many Android developers, even today.

Activity alias represents a symlink to an Activity. The most popular use of activity alias is to prevent the removal of the app launcher shortcut when the underlying launcher activity is changed.

💡 Activity alias has been residing inside the androiManifest.xml since API 1.

Photo by Daniel Romero on Unsplash

The Curious Case of the missing shortcut

When a launcher icon shortcut is created, it is statically linked to the exact activity of the Launcher. …


Fuel is not an alternative for Retrofit because both the libraries offer a different experience for developers. Retrofit is currently the market standard so let us look into Fuel.

Android Network profiler
Android Network profiler

What is Fuel ? ⛽

Is Fuel a 🆕 Library in the market ?

I had a quick look at the release tags in Github and the first tag 0.6 was dated 11 Aug 2015. Its been around for quite some time now. …


Kotlin Interface supports default implementation. Which implies that we can have a default implementation to all the properties and functions defined in the Interface.

The debate:
Having default implementation on interface is not appreciated by many developers. We are not going to discuss about the pros and cons, but we are more interested in how Kotlin has achieved this.

Note: To keep things simple, the java code blocks used in this article is the decompiled java equivalent of the generated byte-code by the Kotlin compiler.

Let’s get started

Lets take a basic interface Wheels with default implementations as an example to understand the…


As the name states, a data class is a class that holds data. The difference from the normal class is the auto-generation of some standard functionality and utility functions derived from the data itself.

Have you asked anyone this question ? “What’s the difference between a normal class and a data class ?”….

Usually their reply would be:

Little do they understand that there are few more functionalities generated along with the usually known functions.

1) Copy()

The copy() function is…


Cold folding is a good practise while working on complex code. It helps us to be focus on the task ahead and not get distracted by unnecessary information. It also helps in organising code or hiding less useful information so one can focus on more important information.

In this blog we will focus on Regions, a small topic in code folding.

Defining custom Region block

The syntax to create a custom regions starts with a comment followed by the keywordregion and end block with the comment endregion. This can be very helpful in grouping of code and also for documentation.

Syntax: Java/Kt file

//region $NameOrDescriptionOfRegion
someCodeHere()
//endregion


The ability to work on multiple projects with different team members have always been the strong suite of people at Modulotech. Over the years we have been successful in sharing our knowledge with everyone and every project, as we have multiple contributors working towards the same goal. The journey towards this goal is not yet achieved, as the journey never ends.

Here, I would explain a small change in our big journey, our transformation from an unformatted git message to a better solution.

Photo by Yancy Min on Unsplash

Every change is treated as a magic trick. We are the magicians and the audience.

Every magic…


It is one thing to come up with intuitive naming for String keys but its totally another to manage and organise your colors in an Android project.

The Problem :

Your colors.xml will initially have the primary, primaryDark and accent by default, based on your theme pallette.

Later you would add few colors with their proper name.
ex: white, black, red etc,.

But before you could realise, you would have started adding the location of the color, as the key, rather than the color itself.
ex: login_bg_color

Alfred

Tech Lead Android, Modulotech

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