Skip to content

Commit

Permalink
Update Coding Conventions to match Compose and Ktor conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
edrd-f authored and koshachy committed May 31, 2024
1 parent fa8d26d commit 04d16ba
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/topics/coding-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,11 @@ class MyTestCase {
### Property names

Names of constants (properties marked with `const`, or top-level or object `val` properties with no custom `get` function
that hold deeply immutable data) should use uppercase underscore-separated ([screaming snake case](https://en.wikipedia.org/wiki/Snake_case))
names:
that hold deeply immutable data) should use upper camel case names:

```kotlin
const val MAX_COUNT = 8
val USER_NAME_FIELD = "UserName"
const val MaxCount = 8
val UserNameField = "UserName"
```

Names of top-level or object properties which hold objects with behavior or mutable data should use camel case names:
Expand All @@ -201,8 +200,11 @@ Names of properties holding references to singleton objects can use the same nam
val PersonComparator: Comparator<Person> = /*...*/
```

For enum constants, it's OK to use either uppercase underscore-separated names ([screaming snake case](https://en.wikipedia.org/wiki/Snake_case))
(`enum class Color { RED, GREEN }`) or upper camel case names, depending on the usage.
Enum constants should also use upper camel case names:

```kotlin
enum class Color { Red, Green }
```

### Names for backing properties

Expand Down

0 comments on commit 04d16ba

Please sign in to comment.