Refactorings item #684767, was opened at 2003-02-11 17:45
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=451586&aid=684767&group_id=44253
Category: None
Group: None
Status: Open
Priority: 8
Submitted By: Charles Reis (csreis)
Assigned to: Charles Reis (csreis)
Summary: True Model View Controller Design
Initial Comment:
Currently, there is *far* too much logic in MainFrame,
beyond the fact that it currently serves as both our
view and controller. It would be much easier to test
aspects of the view and controller if they were
separated into different components and the extra logic
was moved into the model where it belonged.
I've been playing around with this, and I think I've
come up with a reasonable scheme. It's a big
refactoring, though, so I'd appreciate some help
discussing the design and pairing on the
implementation. Post here if you're interested.
General approach:
The UI package will contain pure Swing components where
possible. SingleDisplayView will set up the layout and
bring most of the Swing components together, such as
the menu bar, tool bar, split panes, tabbed panes, etc.
(Each of these could be in its own mindless Swing
class, similar to what we have now, but perhaps with
less logic.) Nothing here knows how to do anything
(eg. menu items have no actions), but methods exist to
set state (such as entering a compilation state, or
showing a particular document). These methods can be
tested to ensure that their side effects occur, but
without needing to have a model around at all.
The edu.rice.cs.drjava package will have a
SingleDisplayController class that creates a model and
a view. It contains the code for *all* Action objects
for the view to send calls to the model, and it
contains all Listeners for the model to notify the
view. The controller can also be instantiated with a
lightweight "dummy" model and view, so that the
behavior of the actions and listeners can be tested
without much overhead.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=451586&aid=684767&group_id=44253
|