• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Business logic

 
Francois Meillet
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I would like to know your advice about the business layer.
Should I degign an entire business layer or just one class (as a controler) ?
ex: Airport, Flight, Reservation
or FlightService which will handle the search and reservation operation.
Thanks for your help.
Francois
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you are talking about the RMI server layer. I would go with one class which implements the remote interface and handles the search and booking of flights.
 
tom mcmorrow
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i think what Francoise is treating of is not really the rmi server layer, but rather a facade class that recides on the client and will leave the client unaware of whether he is dealing with a remote or local database.
i found this a difficulty myself, to clearly establish the functions of the class and not to allow too much coupling with my TableModel class.
Although i now have finished i never really was happy with this section - i have no doubt this is partially due to my lack of experience of dealing
with thngs like beans etc.
However i think the business class itself should not need to include much because of limited functionality required at least my class had only a few methods.
tom
 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Francois,
I've got one flight services facade controller for the assignment. one of the methods on the controller is getFlight, that takes the flight number and returns a flight object.
the flight object is I suppose a business object, which encapsulates all the flight's attributes. My flight object has a method called reserveSeats which obviuosly handles the reservation attempt.
I think the facade controller is a good for wrapping and providing a unified interface to the local or remote database subsystems, but i personally think this is where it's role should end.
if you were to hold all the selected flight information and expose the reserveSeats method on the facade controller and not on a flight object, you are moving away from an object oriented design.
What's the opinion on having an application controller in the persentation layer, so that the FlyByNightGui JFrame is thinned out, and the application logic is moved into a "pure fabrication" object.
I believe that a goal of OO is to have a greater number of specialised classes that serve a specifc purpose, rather than fewer classes trying to do many jobs.
I think refactoring the application logic from the FlyByNightGUI JFrame into an Application Controller is more OO, and maintainable (which is one of the requirements).
I have not done any commercial Swing development. Can somebody say what would be done in the "real world".
Cheers, Dean
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did one realworld Swing application couple of years ago. I used Mediator pattern a lot. It is a good idea to take care of validation in a seperate class so that you can use it in Swing app or JSP application on the server side. For this assignment, I have mediators for the JFrame and for search and flight details panels. I have listeners in the mediators and any logic to validate, send data to the server or local Data object is done by the mediator and not the gui components.
In addition to that I have a client side DataFactory to create or get Data object and a proxy object to act as a Proxy to the _Stub or the Data object.
 
Graham W Lowe
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dean,
In your design, is your flight object utilizing your flight services facade controller for actions on the database (i.e., all calls to the Data class are made from your services facade controller)? From your description, it sounds like you have some layering going on--services layer, business layer and presentation layer.
I just wanted some clarification on this because I'm doing something similar in my assignment.
Thanks
 
dean tomlinson
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi graham,
on my flightServicesFacade controller i have a method Flight getFlight(String flightNumber).
the Flight object is constructed using the DataInfo object for the flight selected in the JTable, and a referecne to the DataAccess object.
my Flight class has a public method reserveSeats(int), and this calls the private methods enoughSeatsAvailable(DataInfo, int) and reduceNumberOfSeats(DataInfo, int).
hope this helps - dean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic