For anyone who sees value on the presentation, I think you might be interested in the _Domain Modeling Made Functional_ book by Scott Wlaschin. Other talks on the same matter you can find on TH-cam: - _The State of Representing State by Christina Lee_ --> Android Makers 2018 -_Design for errors - An introduction to Domain Modeling with a bit of Arrow_ by Ivan Morgillo --> Droidcon Berlin 2019
Good talk overall. Sealed classes seems to be a good solution for guarding the state, especially since Intellij will nag about missing "when branches" for the state in question. Performance takes a minor hit since a new object has to be created every time the state is being changed, but this can be prevented if the state does not hold any additional information (member variables) by defining the subclasses as static objects inside the sealed class: // . // . sealed class A { // static "fast" states object B: A() object C: A() // slow state, requires object creation class D(val info): A() } // . // . One could also create set of static states from the subclasses of a sealed class if all of the possibilities of the state are known in advance. With this in mind, it would seem that sealed classes with only static object states would be superior to enums in every case since you get the flexibility to expand the states if needed, but I'd guess that pattern matching the state inside "when" is more expensive compared to simple enum?
This presentation felt a bit empty. So what is she saying in the end? We should prefer sealed classes, data classes and enums over primitive types and we should avoid illogical structures (that have fields which contradict other fields of the same structure). I think I just saved you 40 minutes... If you watched the video, please let me know if I'm missing something here...
You should try watching the talk again! There's a lot to absorb here. The big takeaways: 8:53 -- When you have lots of faceless data types in your code, consider painting them with their domain meanings. Make them distinct, make them memorable, make them maintainable. 18:04 -- When you break up data use expressive types to capture that break in a place that can be used again. Leverage types for reuse. 26:58 -- Prefer binding unbounded or expansive types to bounded types. 35:40 -- If you want code to unreachable, it should be unreachable at the compile level. And here are some more specific notes that I personally made while watching this talk: 5:26 -- "Provenance" is the origin of data, and is necessary for understanding the context of a "faceless" data type like a boolean. Without knowing data's provenance, we're left with "boolean blindness." 13:42 -- The nullability of an object can depend on an Android app's lifecycle, which creates an implicit "time spectrum of nullability." 15:53 -- For true/false data like "AutoplayEligible" you can make an interface that is composed of multiple interfaces like "IsHighEndDevice" and "InAutoplayExperiment" to which your state objects can conform. These interfaces can be reused. 18:31 -- Another way to reuse data like this (the result of calculations) is through memoization. 32:10 -- Initial states of objects like presenters shouldn't be illogical, even you think that illogical state should never happen (because it probably will if you have tons of users). Be careful with lateinit and var for the this reason. 41:40 -- Using expressive, domain-specific types is a performance tradeoff.
I want to create an android app.I have searched alot for an android developers and finally got a company ,they accepted my idea and they asked some to make that app to create.They said that they need layout designer,upi designer and other some developers. can any one help me to invest the money and get partner with me....Get join with me
For anyone who sees value on the presentation, I think you might be interested in the _Domain Modeling Made Functional_ book by Scott Wlaschin.
Other talks on the same matter you can find on TH-cam:
- _The State of Representing State by Christina Lee_ --> Android Makers 2018
-_Design for errors - An introduction to Domain Modeling with a bit of Arrow_ by Ivan Morgillo --> Droidcon Berlin 2019
Good talk overall. Sealed classes seems to be a good solution for guarding the state, especially since Intellij will nag about missing "when branches" for the state in question. Performance takes a minor hit since a new object has to be created every time the state is being changed, but this can be prevented if the state does not hold any additional information (member variables) by defining the subclasses as static objects inside the sealed class:
// .
// .
sealed class A {
// static "fast" states
object B: A()
object C: A()
// slow state, requires object creation
class D(val info): A()
}
// .
// .
One could also create set of static states from the subclasses of a sealed class if all of the possibilities of the state are known in advance. With this in mind, it would seem that sealed classes with only static object states would be superior to enums in every case since you get the flexibility to expand the states if needed, but I'd guess that pattern matching the state inside "when" is more expensive compared to simple enum?
By far one of my favorite kotlin talks
Very informative talk and I also like the style of Christina's presentations.
Especially like the "how real development works" part. Nobody sets out to write bad code.
Wondering why this lady wasn’t given a standing ovation
Speaking about strings I can generate an infinite number of talks. :D
Absolutely fabulous talk! Hear. Hear! 👏
awesome one
anyone knows what a title for the music opener?, sounds catchy i like it!. really appreciate for the clue, thanks!
This presentation felt a bit empty. So what is she saying in the end?
We should prefer sealed classes, data classes and enums over primitive types and we should avoid illogical structures (that have fields which contradict other fields of the same structure). I think I just saved you 40 minutes...
If you watched the video, please let me know if I'm missing something here...
You should try watching the talk again! There's a lot to absorb here.
The big takeaways:
8:53 -- When you have lots of faceless data types in your code, consider painting them with their domain meanings. Make them distinct, make them memorable, make them maintainable.
18:04 -- When you break up data use expressive types to capture that break in a place that can be used again. Leverage types for reuse.
26:58 -- Prefer binding unbounded or expansive types to bounded types.
35:40 -- If you want code to unreachable, it should be unreachable at the compile level.
And here are some more specific notes that I personally made while watching this talk:
5:26 -- "Provenance" is the origin of data, and is necessary for understanding the context of a "faceless" data type like a boolean. Without knowing data's provenance, we're left with "boolean blindness."
13:42 -- The nullability of an object can depend on an Android app's lifecycle, which creates an implicit "time spectrum of nullability."
15:53 -- For true/false data like "AutoplayEligible" you can make an interface that is composed of multiple interfaces like "IsHighEndDevice" and "InAutoplayExperiment" to which your state objects can conform. These interfaces can be reused.
18:31 -- Another way to reuse data like this (the result of calculations) is through memoization.
32:10 -- Initial states of objects like presenters shouldn't be illogical, even you think that illogical state should never happen (because it probably will if you have tons of users). Be careful with lateinit and var for the this reason.
41:40 -- Using expressive, domain-specific types is a performance tradeoff.
This talk went over your head.
lmao what a failure
I didn't understand most of it but the presentation is too good to skip. 😍
Indeed entertaining
Great presentation!
Why not use Behaviors from Functional Reactive Programming to define declaritivly what the state of the view is for any given point in time?
if you have reference / source code example for that, that's awesome
You talking about Reader Monad?
I want to create an android app.I have searched alot for an android developers and finally got a company ,they accepted my idea and they asked some to make that app to create.They said that they need layout designer,upi designer and other some developers.
can any one help me to invest the money and get partner with me....Get join with me
With all said, is there a need for `if/else` statements anymore?
why, did she remove them, i missed sth ?
I like har presentations in general and this was as good.
She is amazing.
It is possible that someone whose heart is broken is watching the talk... : )
Would have been nicer, and quicker, without the theatrical voice.
OMG , she took this long to deliver enum types , sealed classes . all other things what she explained is to simple cover up time.
Well, this was rather boring.