Blog posts

2019

How to write a testable code

8 minute read

Published:

Why We Need Unit Testing!

let’s see this snippet of code

fun invalidateCache(users: List<User>) {
	val userIds=users.map{it.userId}
    getDBUsers().forEach { user ->
        if (user.userId == null) {
         	//invalid data
            DatabaseManager.deleteAllUsers()
            return
        } else (!usersIds.contains(user.userId))
        DatabaseManager.deleteUserById(it.userId)
    }
}

2018

Moving from Java to Kotlin (Android)

1 minute read

Published:

The first time I heard about Kotlin I thought of it as a new language with a different syntax, but then I turned out to be wrong!