Hey Giorgos, this might not be the best way to approach the "empty state" issue but it's certainly a neat trick that you can apply using the Kotlin standard library.
How you approach the problem and architect your application differs from person to person, isn't it?
Of course it depends on the person and the team. I think you shouldn't put the label
Taking the rookie approach
For wrapping properties with is not null conditions. On runtime the null check is theoretically faster than the approach described above.
Another way of solving it, it's to design the application in such way that race condition doesn't happen. Try and access the property when and only when is initialised and not before that. So that you avoid such issues.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey Giorgos, this might not be the best way to approach the "empty state" issue but it's certainly a neat trick that you can apply using the Kotlin standard library.
How you approach the problem and architect your application differs from person to person, isn't it?
This is just one way of doing it. :-)
Of course it depends on the person and the team. I think you shouldn't put the label
For wrapping properties with is not null conditions. On runtime the null check is theoretically faster than the approach described above.
Another way of solving it, it's to design the application in such way that race condition doesn't happen. Try and access the property when and only when is initialised and not before that. So that you avoid such issues.