Damn I missed a rant!
# chicago
b
Damn I missed a rant!
😂 1
c
It was a late night. I fumbled through at least 5 of the 180 slides. I realized after the fact I missed my hook for why class delegation kicks butt 😭
b
I have to try that to get a bit more how it works.
c
Any questions you have currently about delegation? I’d be happy trying to answer them
b
I understand the delegation properties
but I don't really get what delegation classes are good for
I can see that I could use that to make a different kind of "view" of a class
with different methods
c
Oh perfect, I don’t understand how to do delegated properties work but I like delegated classes
So delegated classes I use when I want composition for a given class. So if you use RxJava one that I like having is a DisposableHandler so you can have a consolidated way of keeping track of disposables. So I have something like
addDisposable
and
clearDisposables
and then my Activity, Fragment, ViewModel, and everything else that might need to manage that
I like them though because you define the interface, you define the concrete class that implements the interface and then everything else that needs the interface you just define it with the
by
keyword. I can send over a few examples
b
I did see the examples from your slides
but I think it requires some rxjava knowledge to get why it is useful
c
Are you an Android Dev, or do you use Kotlin for other things?
b
server and web
and desktop
c
Have you ever had issues with deeply nested class hierarchies? Like a god class that does a lot of stuff?
b
not yet 😛
c
Gotcha. Those are usually situations where Class Delegation works nicely 😂
For Android you have Activity, Fragment, and View which are all fairly common things that you can extend and they all have logic you might want to share. Without delegation it’s a ton of copy paste to share that logic
b
I'll hit you again when I get large classes 😛
👀 1