<p>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.</p>

<p>What's the best pattern/framework/library for communications between the UI and the domain? This boils down into:</p>

<ul>
<li>the UI being able to convert a user gesture into a domain action</li>
<li>the domain being able to send state/result information back to the UI for display purposes</li>
</ul>

<p>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?</p>

[{'answer_id': 69948, 'author': 'SCdF', 'author_id': 1666, 'author_profile': 'https://Stackoverflow.com/users/1666', 'pm_score': 0, 'selected': False, 'text': '<p>I have used the Observer pattern (using AspectJ magic) in the past with <em>some</em> success, but found that unless you were careful it quickly became a cluster.. uhh.. flick?</p>\n<p>It quickly became hard to manage and most importantly extremely hard to debug.</p>\n<p><strong>Edit:</strong></p>\n<p>To expand slightly on my answer, we were using <a href="http://en.wikipedia.org/wiki/Standard_Widget_Toolkit" rel="nofollow noreferrer">SWT</a>, not Swing, so YMMV. We basically used AspectJ to hook up the transference of data from the UI components to the model objects. These model objects were dumb POJOs.</p>\n<p>Actual business logic was done by \'watching\' the model objects with AspectJ and firing off the required event if they changed. So if you changed a value in a textbox AspectJ would fire and copy that value into a POJO. If that field in the POJO had an event on it for business logic that would <em>then</em> fire. If that logic modified any POJOs (and it could) AspectJ would notice and copy the value from the POJO into the UI component.</p>\n'}, {'answer_id': 69990, 'author': 'Chris Kimpton', 'author_id': 48310, 'author_profile': 'https://Stackoverflow.com/users/48310', 'pm_score': 3, 'selected': True, 'text': '<p>Definitely MVC - something like this <a href="http://www.leepoint.net/notes-java/GUI/structure/40mvc.html" rel="nofollow noreferrer">example</a> 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</p>\n'}, {'answer_id': 73436, 'author': 'Aidos', 'author_id': 12040, 'author_profile': 'https://Stackoverflow.com/users/12040', 'pm_score': 1, 'selected': False, 'text': '<p><strong>MVC</strong> is fantastic for an individual widget, however it gets a little unruly when you have <code>pages</code> and <code>forms</code> with lots of widgets.</p>\n\n<p>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 <a href="http://web.archive.org/web/20070618134019/https://beansbinding.dev.java.net/" rel="nofollow noreferrer">Beans Binding Framework (JSR295</a>)</p>\n'}]
['https://Stackoverflow.com/questions/69927', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10433/']