https://kotlinlang.org logo
#announcements
Title
# announcements
s

standinga

11/29/2019, 7:13 PM
does it make sense? or this is not the best approach? Thanks!
k

karelpeeters

11/29/2019, 7:27 PM
Why not just have separate
nextMovie
and
nextImage
?
k

Kroppeb

11/29/2019, 7:29 PM
Or an
enum
?
s

standinga

11/29/2019, 7:51 PM
I have more assets I put two to simplify
I mean more asset types
I thought about that approach because this way I don't need to update enum when new types appears. I've started just from Movie and Image, but I now I have also Audio and Light
and probably more to come (depending on what my client comes with)
My initial approach was nextMovie and nextImage
The reason I want to make it generic is I want to abstract presenting them into AssetPresenter
if I keep them generic I will be able to keep internals of presenter private and my AssetPresenter only exposes a few methods and it just returns view (image or video) which I add to my container
c

codeslubber

11/30/2019, 1:29 AM
In that case, the asset is not really a base class, but just an interface. Stated goal of interfaces is to make it possible to treat dissimilar things in a given way. Your main use is in a presenter, hence no real domain benefit of constraining everything to a single hierarchy inheritance scheme. Before you do that you have to have not just attributes but behavior, AFAIC. (Interface could just be PresentableItem, as there is no real use of the concept of an asset here, which implies value.)
s

standinga

12/01/2019, 5:26 AM
hey good point will think about it! Thanks
👍🏻 1
3 Views