-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rename 'foo' function to 'simple' in flow docs #2078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The name 'foo' might be hard to get for novice developers. It is really hard to find a "meaningful" name for all examples in the docs, so this is simply a consistent solution. The alternative is to something like "simpleFlow", but adding a "Flow" suffix to the name implicitly condones Hungarian notation, which is not aligned with Kotlin coding style.
cc @LouisCAD |
Suffixing a symbol for the sake of an example isn't endorsing Hungarian notation to me. In application code, I often suffix the symbols of type val isOnFlow = whatever().distinctUntilChanged()
isOnFlow.collectLatest { isOn -> doSomeStuff() } compared to: val isOn = whatever().distinctUntilChanged()
isOn.collectLatest { isOn -> doSomeStuff() } That's why I personally prefer I'm also not a fan of Of course, for the examples where the fact that the flow is simple is relevant (e.g. showing how to make a simple flow with the most basic builder, That's ony my point of view. That's alright if you disagree. Also, maybe we can ask other developers on Kotlin's Slack, or developers in this Twitter thread for example (cc @ahinchman1) to get other angles and confidence in the chosen naming? |
A few other namings that I (personally) find alright and less confusing than |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but adding a "Flow" suffix to the name implicitly condones Hungarian notation, which is not aligned with Kotlin coding style
Doesn't look Hingarish to me either, but it is potato-potato anyway. The change brings enough value to merge it as-is instead of bikeshedding for me.
The name 'foo' might be hard to get for novice developers. It is really hard to find a "meaningful" name for all examples in the docs, so this is simply a consistent solution. The alternative is to something like "simpleFlow", but adding a "Flow" suffix to the name implicitly condones Hungarian notation, which is not aligned with Kotlin coding style.
The name 'foo' might be hard to get for novice developers. It is really hard to find a "meaningful" name for all examples in the docs, so this is simply a consistent solution. The alternative is to something like "simpleFlow", but adding a "Flow" suffix to the name implicitly condones Hungarian notation, which is not aligned with Kotlin coding style.