Re: Action vs Controller
In java we have two options on how to implement event handling
* First is to subclass AbstractAction, define all action handling
logic within this subclass and then initialize all GUI controls with
an object of this subclass or call setAction on controls.
I've never seen any designs actually use this. Not that I'm an expert
Everything in the GUI world I've seen uses MVC or a related pattern. It
might be best to stick to what another programmer is going to familiar
with and able to maintain. "Exit strategy" and all that. Plus MVC is
portable, whereas Swing's action system may not work anywhere else if
you have to port your application.
If you'd like to explain what you think the advantages of using Actions
are over MVC and event listeners, I'd like to hear it. Just looking at
it, AbstractAction inherits several fields and these look like they
would take up a fair memory footprint if there were many of them, which
there might be in a real GUI design. Event listeners seem like they
might be somewhat lighter weight.
If you are looking for alternatives to MVC, check out Presenter First:
The links at the end of that article are great. Don't miss the PDF one
by the Atomic Object folks, but there is also an excellent video by
Brian Marick which gives a concrete (if simple) example in Java. It's
much better than designs I've seen posted here involving lots of
Callables everywhere (which would be very heavyweight).