I need to create a Playlist, I want to separate code/logic and GUI by using two classes:
Playlist
(code/logic)PlaylistGui
(GUI)
It shall be possible to use the Playlist class standalone, e.g. in some kind of command line environment. The question now is, how would one plug both classes together, when using a GUI? My ideas until now:
- Expose an observable list from the
Playlist
class, create a methodsetItemSource(Playlist source)
on thePlaylistGui
class - Not sure if possible in Java, just know this from .NET: Let
Playlist
class fire events and letPlaylistGui
catch them, should lead to uncoupled code? :-)
Open for new ideas :-) Note I am using Java 7 and JavaFX, though I guess JavaFX doesn't limit possiblities, just extends them.