david.bilik03/27/2020, 11:30 AM
type? eg. im observing users from database, should i name it like
? There is a lot of options and im curious about the best practices
fun users() : Flow<List<User>> or fun observeUsers() : Flow<List<User>> or fun usersChanges() : Flow<List<User>> or fun getUsersStream() : Flow<List<User>>
sindrenm03/27/2020, 6:14 PM
. Whether it's a well-used convention, I don't know.
Marc Knaup03/31/2020, 5:52 AM
as it’s mostly redundant in Kotlin and rarely used.
would be fine imo 🙂
sindrenm03/31/2020, 10:04 AM
Marc Knaup03/31/2020, 10:13 AM
sindrenm03/31/2020, 10:24 AM
Orhan Tozan04/14/2020, 3:12 PM
is what I would use, however, when there is some initial loading going like an initial overhead, I would call it
should be the same, regardless how often I call it in a row
david.bilik04/15/2020, 2:57 PM
in the past as well (with Rx) but now when I thought about it it does not make sense - the method is not observing anything, its returning me the observable. I am observing the result that the method will return me. I went with
Marc Knaup04/20/2020, 11:44 AM
. The plural “users” doesn’t make it much better imo as it’s easy to miss and not every word has a plural “s”, so consistency is difficult. It could be either a “user list stream” or “user list state”. I associate “stream” with something that keeps appending new data as it becomes available. The
more likely emits a completely new list every time that replaces the previous list. Hence “state”.