Most values have a specific unit in mind. For example val distance: Long stores the distance in meters or kilometers. But that is not expressed in the code. For easy recognition of what is meant and to extend specific use cases a named class should be used. Beside fields these new classes should also be used as return values and may improve local variable usage.
Implementation detailsInline classes can be used to prevent un-/wrapping the values for all those data operations.
Description This comes from a review comment.
Most values have a specific unit in mind. For example
val distance: Long
stores the distance in meters or kilometers. But that is not expressed in the code. For easy recognition of what is meant and to extend specific use cases a named class should be used. Beside fields these new classes should also be used as return values and may improve local variable usage.Implementation details Inline classes can be used to prevent un-/wrapping the values for all those data operations.