Silly question, but I believe, basic discipline li...
# announcements
j
Silly question, but I believe, basic discipline like that adds up to cleaner code… I have data class that should be called
List
. How would you name that class?
r
What types would you store in that list?
j
this is my
Entity
something like
Copy code
data class List_(
    val uuid: String = UUID.randomUUID().toString(),
    val name: String = "",
    val entries: List<Entry> = emptyList()
)
I’m calling it
List_
but smells a bit
r
I won't call it List since that's already an existing type. I would add something to the name that makes it clear what makes this data class different than the existing
kotlin.collections.List
d
Lists and Entry... so very generic... but maybe EntryList then 🙂
r
I won't prefer such generic names either, but agree with David..
Or
NamedList
, because this is a List with a Name
👍 1
Copy code
data class NamedList<T>(
    val uuid: String = UUID.randomUUID().toString(),
    val name: String = "",
    val entries: List<T> = emptyList()
)
j
Hah, after working for a big company where names were like
NamedWithEntriesAndAttachedList
I’m just so much in love with short names that are not noisy. But drawbacks are when you wanna refactor it in IDE and sometime names conflicts like now 😉
Will go for
ShoppingList
Cheers guys!
👍 2
r
Yeah, that sounds like a meaningful name ;)
j
There are two great problems in Computer Science. Naming things, cache invalidation, and off by one errors.\