M
Martin Gregorie
I'm developing a database system that includes both command line and GUI
programs. As both GUI programs need to display fairly large amounts of
data, much of it dependent on precious decisions by the user, they both
use a number of screens this type of relationship:
initial screen - prompt for selection criteria
pop-up screen displaying a selectable list
pop-up screen showing the selected item's details
These programs use the MVC model. Currently each program has one Model
and one Controller to handle data and refresh requirements for all the
screens. Pop-ups are controlled by list selection listeners and action
listeners. The model interacts with the database through a JDBC access
layer, implemented as a single class that contains all SQL statements and
JDBC operations.
Question: Is this a common way of managing a multi-window GUI or is
it more usual to have a separate MVC triad for each window?
I've implemented a separate Model class and database access class for
each program. These are subclasses of Model and database access super-
classes that were intended to contain just common operations such as db
open/close and error diagnostics. However, to make some window classes
usable in both GUI programs, its necessary to use super-class references
in them and this in turn has required virtually subclass methods to have
stubs in the super-class. Worse, many have to be concrete, overridable
stubs rather than abstract or stuff won't compile. The result works OK
but is getting somewhat untidy.
Question: Would it be better to get rid of the subclasses by pulling
their code into the current super-classes in place of the
method stubs?
Question: Would the situation be helped by using Interface
definitions? I'm not using t5hem at present.
Question: Is there a book you'd recommend that covers these aspects
of application design?
The code is running reliably at present and with adequate performance
apart from a couple of queries that I haven't yet optimized. However, as
I said, its a bit untidy in places so some refactoring would be
beneficial. I'm posing these questions now so as to, hopefully, avoid
diving into some refactoring black hole.
TIA,
Martin
programs. As both GUI programs need to display fairly large amounts of
data, much of it dependent on precious decisions by the user, they both
use a number of screens this type of relationship:
initial screen - prompt for selection criteria
pop-up screen displaying a selectable list
pop-up screen showing the selected item's details
These programs use the MVC model. Currently each program has one Model
and one Controller to handle data and refresh requirements for all the
screens. Pop-ups are controlled by list selection listeners and action
listeners. The model interacts with the database through a JDBC access
layer, implemented as a single class that contains all SQL statements and
JDBC operations.
Question: Is this a common way of managing a multi-window GUI or is
it more usual to have a separate MVC triad for each window?
I've implemented a separate Model class and database access class for
each program. These are subclasses of Model and database access super-
classes that were intended to contain just common operations such as db
open/close and error diagnostics. However, to make some window classes
usable in both GUI programs, its necessary to use super-class references
in them and this in turn has required virtually subclass methods to have
stubs in the super-class. Worse, many have to be concrete, overridable
stubs rather than abstract or stuff won't compile. The result works OK
but is getting somewhat untidy.
Question: Would it be better to get rid of the subclasses by pulling
their code into the current super-classes in place of the
method stubs?
Question: Would the situation be helped by using Interface
definitions? I'm not using t5hem at present.
Question: Is there a book you'd recommend that covers these aspects
of application design?
The code is running reliably at present and with adequate performance
apart from a couple of queries that I haven't yet optimized. However, as
I said, its a bit untidy in places so some refactoring would be
beneficial. I'm posing these questions now so as to, hopefully, avoid
diving into some refactoring black hole.
TIA,
Martin