• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design Review part III

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Please go over my review and let me know any comments or critisms you might have.
NOTE: I HAVE OMITTED THE METHOD'S PARAMETERS FOR BREVITY.
suncertify.client
-----------------
public interface Agent
Provides two methods, searchFlight() and bookFlight().
public interface Administrator extends Agent
Provides two methods, addFlight() and deleteFlight().
public interface Operator extends Agent
Provides one method, confirmFlight().
public class BookingDetail
Class used to encapsulate all the details of a booking, such as flight
number, seats, booking date and status (Confirmed, Unconfirmed ...).
public class ClientLauncher
Sets the look and feel of the application and starts off the client
application.
public class FlightDetail
Class used to encapsulate all the details of a flight, such as flight number,
origin airport, destination airport, etc..
public class TravelAgency implements Operator, Administrator
Facade that implements all the business methods, such as searchFlight(),
confirmFlight(), bookFlight(), addFlight(), and deleteFlight(). A reference
of this class is returned as an Operator (see interface def above) to the
client application.


suncertify.client.ui.controller
-------------------------------
Most of the buttons and menu items contained within the GUI application are
represented by seperate actions, whose names give an indication of the role they
play. For example the 'confirm' button's interaction is handled by a 'BookAction'
instance. All the Action instances are declared external to the GUI. Most of the
action instances are passed a reference to a controller (see controller def
below)object.
public class MainController
This class serves as the controller (in the context of MVC) for the GUI
application. Its primary purpose is to create a connection between the
view and data parts of the GUI application. The presence of this class
abstracts the view from the data parts of the application. This class
contains methods which can be used to set data contained within the model.

suncertify.client.ui.model
--------------------------
public interface ClientModel
Defines all the operations that can be used to access the state of the main
GUI application. This interface is 'accessed' by the view of the GUI
application. Only accessors are provided in this interface. This is the
interface that is used by the GUI application, which means that the GUI
application (view) cannot modify the state of the model directly.
public class ClientModelEvent extends EventObject
ClientModelEvent is used to notify listeners that a client model's state has
changed.
public interface ClientModelListener extends EventListener
Defines the interface which is implemented by objects that are interested in
receiving notification changes that occur in the ClientModel object.
public class DefaultClientModel implements ClientModel
This class serves as a default implementation of the ClientModel interface,
which is used by the main GUI application. This class also provides mutators
that can be used modify the state of the model. This class is only accessed
from with the MainController class (defined above).
public class ResultsTableColumnModel extends DefaultTableColumnModel
A custom DefaultTableColumnModel implementation used by the main GUI
application.
public class ResultsTableModel extends AbstractTableModel
A custom <code> AbstractTableModel </code> implementation used by the results
table which is displayed as part of the main GUI application.

suncertify.client.ui.view
-------------------------
public class BookingDialog extends JDialog
A dialog box that is used to display all the details of a flight that has
been selected by the user. This dialog box gives the user the option to
cancel or proceed with a booking.
public class ConnectionDialog extends JDialog
This the first dialog box presented to the user when the client side of the
application starts up. The dialog has options that allow the user to specify
the name of a database, when in local mode and the host name/ip and rmi port,
when in remote mode.
public class GUIMediator
A mediator, that coordinates the interaction between most of the components
contained within the main GUI application.
public class MainView extends JFrame implements ClientModelListener
Main GUI, which is notified when a change in the model's state occurs.
public class UserGuideDialog extends JDialog
Dialog in which the user guide is displayed. This dialog is invoked by the
user guide menu item in the MainView GUI.

suncertify.db
-------------
public class Data implements DataInterface
Modified data class to provide criteriaFind() method and fixed deprecated
methods. CriteriaFind method is capable of searching for any number of
fields provided to it.
public class DatabaseException extends Exception
Unmodified except for javadoc comments.
public class DataInfo implements Serializable
Unmodified except for javadoc comments.
public interface DataInterface
Exposes methods that can be used by both local and remote applications. The
methods in this interface throw both DatabaseException and IOException.
public final class DataInterfaceFactory
This class creates and returns remote or local DataInterface implementations.
Exceptions are rethrown by this class as a custom application exception,
which is caught in the in the MainController class. The MainController class
is responsible for displaying the correct dialog box with the relevant error
message.
public class FieldInfo implements Serializable
Unmodified except for javadoc comments.

suncertify.server
-----------------
public interface DataService extends Remote, DataInterface
Interface that is exported to clients of the remote system.
public interface DataServiceFactory extends Remote
Remote object registered with the RMI registry. Contains a single method,
getDataService(), which is responsible for creating and returning DataService
instances to the client. Each client will get a unique DataService
implementation.
class DataServiceFactoryImpl extends UnicastRemoteObject implements
DataServiceFactory
A DataServiceFactory implementation responsible for creating and returning
DataService objects. This class is also responsible for creating Data and
LockManager instances and allocating them to the new created DataService
implementation. Several DataService implementations can share the same Data
and LockManager instances. Each newly created Data instance has a
corresponding LockManager instance tied to it within the DataService
implementation.
class DataServiceImpl extends UnicastRemoteObject implements DataService,
Unreferenced
A DataService implementation, exported to clients of the remote system which
is used to wrap calls made to the database file. Instances of this class,
which are created by the DataServiceFactoryImpl, contain a reference to the
LockManager and Data instances passed in from the DataServiceFactoryImpl
class. All the database file calls are delegated to the Data instance and
the lock and unlock calls are delegated to the LockManager.
class LockManager implements Runnable
Deals with concurrent database file, access issues. Provides implementations
for the lock and unlock methods. Contains an internal, daemon thread which
deals with deadlocks.
public class Server
Responsible for intialializing the server's environment, binding the remote
DataServiceFactory, object to the registry and starting the server. This
class contains a key listener, which listens out for a 'q' or 'Q' keystroke.
Either of these keystrokes can be used to stop the server application at any
time. Stopping the server will unbind any remote objects bound to the
registry and gracefully exit the application. The key listener runs in its
own, low priority, thread.
public class ServerLauncher
Starts the server side of the application. Command-line parameters are
passed to the server side of the application.
public interface Stoppable
Contains a single call back method, stop() and is implemented by classes that
will need to be stopped before the application exits. I have not included
which classes implement the stoppable interface in this review.

Thank you very much for taking the time out to go over my review.
Regards,
Chiji
 
Chiji Nwankwo
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please review. Thanks for your help.
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chiji Nwankwo:
Hi all,
Please go over my review and let me know any comments or critisms you might have.
suncertify.client
-----------------
public interface Agent
Provides two methods, searchFlight() and bookFlight().
public interface Administrator extends Agent
Provides two methods, addFlight() and deleteFlight().
public interface Operator extends Agent
Provides one method, confirmFlight().

public class TravelAgency implements Operator, Administrator
Facade that implements all the business methods, such as searchFlight(),
confirmFlight(), bookFlight(), addFlight(), and deleteFlight(). A reference
of this class is returned as an Operator (see interface def above) to the
client application.


I only had time to look at your client package, so this only pertains to client:
1) Unless your assignment requires it, you can get rid of your confirmFlight, deleteFlight, and addFlight methods.
2) It may just be a question of semantics, but I don't feel comfortable with part of your object model. In real life, is an operator really an agent? Is a Travel Agency an agent, an operator, or an administrator? A travel agency may have an agent or administrator but it surely isn't an agent or administrator. Also, when I hear operator, I think airline which does not have an is a relationship with any of the other busines entities mentioned. Anyway, I would scrap all of those interfaces and just have one business facade with methods to book flights, and search the database. Keep it simple.
-BJ
 
Chiji Nwankwo
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have made a couple of changes and gotten rid of the interface hierachy from within the suncertify.client package. At the moment all I am left with is the the TravelAgency facade, which contains the bookFlight() and searchFlight() method. I have also removed the BookingDialog class, and placed the 'book' button on the main GUI. So at the moment the user can click on the book button from within the main GUI without a confirmation screen popping up to display their selection.
Eventhough lock and unlock are provided as part of the DataInterface interface, it is only called from within the remote object. So no lock or unlock method is called when in local mode. This is a code snippet from the modify method, which is implemented by the remote interface implementation, DataServiceImpl:
 
Chiji Nwankwo
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Does anyone have any other issues with my design. Please comment as your input is very important.
Regards,
Chiji
 
Chiji Nwankwo
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Does anyone have any other issues with my design. Please comment as your input is very important.
Regards,
Chiji
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic