Kotlin file names


#1

I started to write some code in Kotlin.
I don¨t want to write every class in separate file as IntelliJ suggests, Kotlin classes are often small. But I need some system how to find specific class. So I started to use this conventions for file names:

kotlin file = kotlin package

src
|-main
  |-kotlin
    |-a
      |-c.kt - package x.y.z.a.c
      |-d.kt - package x.y.z.a.d
    |-a.kt - package x.y.z.a
    |-b.kt - package x.y.z.b

What do you think about it?


#2

You can refer to the structure of JS projects.


#3

I consider this pattern clear and readable, unfortunately I didn’t found any way to check the package pattern consistency.


#4

It would be nice to see warnings in ide on the rule violation and to have support for refatoring on file movement… May be in the future.

How create file names you or other kotliners?