I have some domain logic implemented in a number of POJOs. I want to write a Swing user interface to allow the user to initiate and see the results of various domain actions.
What's the best pattern/framework/library for communications between the UI and the domain? This boils down into:
I'm aware of MVC as a broad concept and have fiddled with the Observer pattern (whose Java implementation has some drawbacks if I understand correctly), but I'm wondering if there's an accepted best practise for this problem?
Definitely MVC - something like this example which clearly splits things out. The problem with the Swing examples is that they seem to show the MVC all working within the swing stuff, which does not seem right to me
MVC is fantastic for an individual widget, however it gets a little unruly when you have pages
and forms
with lots of widgets.
One thing that might be worth looking into (and I'm not endorsing it, I haven't actually used it, just implemented something very similar for myself) is the Beans Binding Framework (JSR295)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With