Kihagyás

Single responsibility principle

A class shall have one and only(!) one reason to change, which includes that a class should do one thing.

This principle is easy to maintain, and pretty straight forward.

class User(var name: String, private var id: Long, private var birth: Date) {

    fun getAge(): Long {
        return Date().time - birth.time
    }

    fun creationDate() {
        Date(id shl 22)
    }

    suspend fun pingUserServer() {
        val client = HttpClient(CIO)
        val response: HttpResponse = client.get("https://ktor.io")
    }
}

Is this an asynchronous call from a near data class???!!! Holly smokes it does not look Single responsibility

You shall have a separate class for making http requests...

After some cleanups

class User(var name: String, var id: Long, var birth: Date) {

    fun getAge(): Long {
        return Date().time - birth.time
    }

    fun creationDate() {
        Date(id shl 22)
    }
}

class ServerConnector(private var location: String) {
    /*...*/

    suspend fun pingServer() {
        val client = HttpClient(CIO)
        val response: HttpResponse = client.get(location)
    }

    suspend fun sendToServer(data: String) {
        val client = HttpClient(CIO)
        val response: HttpResponse = client.post(location) {
            setBody(data)
        }
    }
}

And as you can see, there's room to extend, but make sure you keep your class doing one thing and one thing only