Hiring guide for Kotlin Engineers

Kotlin Developer Hiring Guide

Kotlin is a statically typed, cross-platform programming language developed by JetBrains. It is designed to be fully interoperable with Java and other languages that run on the Java Virtual Machine (JVM). Kotlin introduces functional features to support Java interoperability. The syntax of Kotlin is more expressive and concise than that of Java, which makes it easier to read and write. It can be used for any kind of development including server-side, client-side web or android application development. In 2017, Google officially announced its support for Kotlin in Android app development making it even more popular among developers worldwide.

Ask the right questions secure the right Kotlin talent among an increasingly shrinking pool of talent.

First 20 minutes

General Kotlin app knowledge and experience

The first 20 minutes of the interview should seek to understand the candidate's general background in Kotlin application development, including their experience with various programming languages, databases, and their approach to designing scalable and maintainable systems.

How would you define a variable in Kotlin?
You can define a variable in Kotlin using either 'val' or 'var'. 'val' is for read-only (immutable) variables and 'var' is for mutable variables. For example, 'val a: Int = 1' or 'var b: Int = 2'.
What are the basic types in Kotlin?
The basic types in Kotlin are: Numbers (Byte, Short, Int, Long, Float, Double), Characters, Booleans, Arrays, and Strings.
Describe the difference between 'val' and 'var' in Kotlin.
'val' is a read-only (immutable) declaration and can be initialized only once. 'var' is mutable and can be changed after initialization.
How would you implement inheritance in Kotlin?
In Kotlin, a class can be derived from another class using the ':'. For example, 'class MyDerivedClass: MyBaseClass()'. By default, classes in Kotlin are final. If you want to allow a class to be inherited from, you must mark it with the 'open' keyword.
What are data classes in Kotlin and how would you use them?
Data classes in Kotlin are used to hold data/state and automatically provides some standard functionality like 'toString()', 'equals()', 'hashCode()', and 'copy()'. You can define a data class using the 'data' keyword. For example, 'data class User(val name: String, val age: Int)'.
The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

What you’re looking for early on

Does the candidate have a solid understanding of Kotlin syntax and concepts?
Has the candidate demonstrated problem-solving skills during the interview?
Is the candidate familiar with using Kotlin for Android development?
Can the candidate effectively communicate their thought process and solutions?

Next 20 minutes

Specific Kotlin development questions

The next 20 minutes of the interview should focus on the candidate's expertise with specific backend frameworks, their understanding of RESTful APIs, and their experience in handling data storage and retrieval efficiently.

How would you handle null safety in Kotlin?
Kotlin provides null safety by distinguishing nullable types and non-nullable types. You can specify a variable as nullable using the '?' after the type. For example, 'var a: String? = null'. To access the variable safely, you can use the safe call operator '?.'.
Describe the difference between '==' and '===' in Kotlin.
'==' checks for structural equality, while '===' checks for referential equality. In other words, '==' checks if the values are equal, and '===' checks if the references point to the same object.
What are extension functions in Kotlin and how would you use them?
Extension functions in Kotlin allow you to extend a class with new functionality without having to inherit from the class. You can define an extension function using the 'fun' keyword followed by the class name, a '.' and the new function name. For example, 'fun String.myExtensionFunction() = this.length'.
How would you implement exception handling in Kotlin?
Exception handling in Kotlin is done using try, catch, and finally blocks. The code that might throw an exception is put in the 'try' block. If an exception occurs, it is caught in the 'catch' block. The 'finally' block is executed regardless of whether an exception was thrown or not.
What are higher-order functions in Kotlin?
Higher-order functions in Kotlin are functions that can take functions as parameters and/or return functions. For example, 'fun List.customFilter(predicate: (T) -> Boolean): List'. This function takes a predicate function as a parameter and returns a list of items that satisfy the predicate.
The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

The ideal back-end app developer

What you’re looking to see on the Kotlin engineer at this point.

At this point, a skilled Kotlin engineer should demonstrate strong problem-solving abilities, proficiency in Kotlin programming language, and knowledge of software development methodologies. Red flags include lack of hands-on experience, inability to articulate complex concepts, or unfamiliarity with standard coding practices.

Digging deeper

Code questions

These will help you see the candidate's real-world development capabilities with Kotlin.

What does the following Kotlin code do?
val list = listOf(1, 2, 3, 4, 5)
val result = list.filter { it > 2 }
This code creates a list of integers and then filters out the elements that are greater than 2. The result is a new list containing only the numbers 3, 4, and 5.
What will be the output of the following Kotlin code?
fun main() {
val a = 10
val b = 20
println(a == b)
}
The output of this code will be 'false'. It compares the values of 'a' and 'b' using the '==' operator and prints the result. Since 10 is not equal to 20, it prints 'false'.
What does the following Kotlin code do?
val numbers = arrayOf(1, 2, 3, 4, 5)
val sum = numbers.reduce { acc, i -> acc + i }
This code calculates the sum of all elements in the 'numbers' array. The 'reduce' function is used to accumulate the elements of the array into a single value.
What does the following Kotlin code do?
fun main() {
val thread = Thread {
println("Thread is running")
}
thread.start()
}
This code creates a new thread and starts it. The new thread prints 'Thread is running' to the console.

Wrap-up questions

Final candidate for Kotlin Developer role questions

The final few questions should evaluate the candidate's teamwork, communication, and problem-solving skills. Additionally, assess their knowledge of microservices architecture, serverless computing, and how they handle Kotlin application deployments. Inquire about their experience in handling system failures and their approach to debugging and troubleshooting.

Describe the difference between 'apply' and 'with' in Kotlin.
'apply' and 'with' are both scope functions in Kotlin. The main difference is that 'apply' returns the receiver object, while 'with' returns the lambda result. 'apply' is called on an object and 'with' is called with an object as an argument.
How would you use coroutines in Kotlin?
Coroutines in Kotlin are used to simplify asynchronous programming. You can start a coroutine using the 'launch' or 'async' function. Inside a coroutine, you can use 'delay' to suspend the execution without blocking the thread.
What are sealed classes in Kotlin and how would you use them?
Sealed classes in Kotlin are used to represent restricted class hierarchies. They are abstract by themselves and can have subclasses, but all subclasses must be located in the same file. You can define a sealed class using the 'sealed' keyword. They are useful when used in 'when' expressions because you don't need to add an 'else' clause.

Kotlin application related

Product Perfect's Kotlin development capabilities

Beyond hiring for your Kotlin engineering team, you may be in the market for additional help. Product Perfect provides seasoned expertise in Kotlin projects, and can engage in multiple capacities.