Posts by Tags

Android

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)
    }
}

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!

Android Architecture Component

Architecture Pattern

Clean Architecture

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)
    }
}

Clean Code

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)
    }
}

Java

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!

Kotlin

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)
    }
}

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!

MVVM

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)
    }
}

Unit Testing

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)
    }
}