yschimke
10/19/2022, 7:26 AMhhariri
Stefan Oltmann
10/19/2022, 7:57 AMefemoney
10/19/2022, 8:31 AMlouiscad
10/19/2022, 8:32 AMlouiscad
10/19/2022, 8:33 AMribesg
10/19/2022, 8:35 AMJonas
10/19/2022, 8:39 AMRoute
- which I do not like. I also do not like to suffix the view with View
- as this term is really overloaded on Android.
Any suggestions?Emil Kantis
10/19/2022, 3:06 PMRuckus
10/19/2022, 4:05 PMLandry Norris
10/19/2022, 8:29 PMPablichjenkov
10/20/2022, 9:11 PMexternal triggered composition
and internal triggered composition
respectively. Any one else using these terms or just not distinguish between the 2?
Perhaps input parameter triggered
vs internal state triggered
Matteo Mirk
10/21/2022, 8:59 AMMarc Reichelt
10/21/2022, 9:26 AMiosSimulatorArm64()
, iosX64()
and iosArm64()
are named?
• iosArm64()
is for a device
• iosX64()
is for a simulator
• iosSimulatorArm64()
is for a simulator
How could we name these better?sarmad sohaib
10/22/2022, 2:42 PMGeorge
10/24/2022, 1:14 PMinternal inline fun <T> runRecoveringTransaction(transaction: () -> T?): T? {
val result = runCatching { transaction() }
return result.getOrElse {
if (it is DataIntegrityViolationException) return null else throw it
}
}
any suggestions for better name?
• recoverTransaction
-> i think it's a bit generic
• ifRollbackReturnNull
-> a bit weird?Paul Woitaschek
10/24/2022, 5:58 PMYoussef Shoaib [MOD]
10/27/2022, 2:23 AMMR3Y
11/08/2022, 1:32 PMreturn try {
// ...
} catch (e: Exception) {
handleError(e)
}
in some classes that have similar purposes. so, I decided to extract that block into a separate function called something like runCatching
return runCatching { ... }
but the problem is that it would be easily confused with the standard kotlin.runCatching
, and I'm not using kotlin.Result
either. so, I want a good name for that function but I can't think of any name other than runCatching
. Any better ideas?George
11/16/2022, 2:07 PMorThrow
or it's ok to omit it? For example:
private val CspAccount.retrieveAuthenticatedDevice: CspDevice
get() = this.authenticatedDevice.getOrElse {
throw WebApplicationException(
"Authenticated device for account: ${this.number} was not found",
Response.Status.UNAUTHORIZED
)
}
It would be better if i renamed it to getAutheticatedDeviceOrThrow()? Thanks in advance for any answers !czuckie
11/28/2022, 11:39 AMlanguage-support
as in adding things the language doesn't offer but perhaps could.Sam Stone
12/09/2022, 4:49 AMfoos.find { it.id == id }
) so this is nice sugar for me (used like foos.findBy(id) { it.id }
):
inline fun <T, R> Iterable<T>.findBy(key: R, selector: (T) -> R): T? = find { selector(it) == key }
Maybe rename to just find
? findIn
?Vitor Hugo Schwaab
01/14/2023, 12:21 AMSam
01/20/2023, 11:42 AMfold
, but the operation
is allowed to return null
, in which case the whole thing exits early with a null
return value.
private inline fun <T, R> Iterable<T>.fold2(initial: R, operation: (acc: R, T) -> R?): R? =
fold<T, R?>(initial) { acc, element -> operation(acc ?: return null, element) }
Stylianos Gakis
02/03/2023, 6:42 PMinterface AuthenticationListener {
suspend fun loggedIn()
suspend fun loggedOut()
}
This will be in a common module without more dependencies, and whichever module is interested can provide implementations of this interface to do stuff that it may need to do on login or logout.
Then there should be some class which is called ??? Let’s just say AuthenticationEventDispatcher
for now
class AuthenticationEventDispatcher(
authenticationListeners: Set<AuthenticationListener>, // injected
applicationScope: ApplicationScope,
coroutineContext: CoroutineContext,
) {
private val authEvents = Channel<AuthenticationEvent>(Channel.UNLIMITED)
init {
applicationScope.launch(coroutineContext) {
authEvents.consumeAsFlow()
.collect { event ->
authenticationListeners.map { authenticationListener ->
async { when (event) { LOGGED_IN -> authenticationListener.loggedIn(); LOGGED_OUT -> authenticationListener.loggedOut() } }
}.awaitAll()
}
}
}
fun loggedIn() { authEvents.trySend(LOGGED_IN) }
fun loggedOut() { authEvents.trySend(LOGGED_OUT) }
private enum class AuthenticationEvent { LOGGED_IN, LOGGED_OUT }
}
Which should just take these events and inform all the AuthenticationListener instances to do whatever it is that they’re gonna do (One example is that I want to get a member ID when logging in from the backend and save it, but this only works after having logged in first)
So with all this context, how would you better name “AuthenticationEventDispatcher” or even the “AuthenticationListener” which I am also not happy about?Peter Mandeljc
02/07/2023, 10:23 AMFlow<Boolean>
with "is". E.g. val isVisible: Flow<Boolean>
?thanh
02/14/2023, 12:47 PMfun Set<A>nonEmptyIntersection(other: Set<A>) = this.intersect(other).nonEmty()
?pardom
02/21/2023, 8:40 PMdoThing()
◦ doThingAsync()
◦ doThingSuspending()
◦ doThingSuspended()
◦ etc?mbonnin
02/27/2023, 4:51 PMJSON
and not Json
, right? I've been using Json
everywhere but I think I'm wrong?Kshitij Patil
03/11/2023, 1:54 PMBuilder
pattern. You simply have one method Foo.build(param)
in the class interface which gives you the instance. Such classes use some other builder hierarchy by feeding received configurations in param
and gives you concrete instance, IE, abstracting away builder logic.
For instance, I have a custom notification builder class which is using NotificationCompat.Builder()
internally and giving Notification
instance on invocation.