What are the conventions about file’s naming? I u...
# codingconventions
d
What are the conventions about file’s naming? I use upper-case if the file is representative of a class, so the name reflect the class’s name: MyRequest.kt
Copy code
sealed class MyRequest
class MySyncRequest
class MyAsyncRequest
But I use lower case when the file contains generic elements that can not be represented by a single class: requestExtensions.kt
Copy code
fun MyRequest.doSomething() = ...
fun MyRequest.doSomethingOther() = ...
s
why not use uppercase for all file names?
d
Because packages are lowercase, packages are containers. A file like this is nothing more than a container 🙂
For instance, on Java you would have a package
exceptions
with a bunch of very small files. In Kotlin I use the file
exceptions.kt
with a bunch of very small classes