• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UI design question -- need help please

 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Team,
I have split up the ui implementation per MVC.
The View class is ClientScreen class which has just one method to assemble all the components.
It has other hook methods though.
This one assembler method i feel has just too many lines of code in spite of MVC.
Is there any standard way to split this up and/or other good way to implement this. What are some of you who have passed doing ?
---------------------------------------------------------------------------------------------------
The other question i have is that i have a bookseatsmodel class and that class books seats when the controllers asks it do so.
The bookseats method in this class returns an int which tells the controller one of the following:-
final int SUCCESSFULLYBOOKED = 0;
final int NOTENOUGHSEATS = 1;
final int UNEXPECTEDERROR = 2;
Then, based on the above the controller asks the view class to display the appropriate message box.
Is this methodology ok as far as design goes ?
Thanks in advance!
Regards
Suchak jani
[ March 06, 2002: Message edited by: Suchak Jani ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the most part it is good, but what is an unexpected_error? Is it an exception, which shoul d just be thrown, or is it some other failure that caused the booking to fail, and you would like to distinguish between not enough seats and other booking failures. Which sounds ok, that way.
I actually returned a class that is called BookedSeat, and inside it was the flight information, and whether it was successful or not. You could do something similar and have it also have a "Reason" why it failed. It also had the following method that returned a String that could be displayed in a Dialog window


Hope that is ok. You of course don't have to go that far.
OH, and my GUI also had a method that long too, and that is fine.
Mark
[ March 06, 2002: Message edited by: Mark Spritzler ]
 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
Thanks for your quick reply.
For the most part it is good, but what is an unexpected_error? Is it an exception, which shoul d just be thrown, or is it some other failure that caused the booking to fail,
Actually bookseats method in the bookingmodel talks to dataaccess class having the connection object. So unexpected error can be remoteexception,databaseexception etc.
I was thinking that to throw exceptions beyond the model would not serve any point and hence this scheme of common int values, i am also planning to have a FlightAppConstants to have all these values.
In fact ,Your solution looks great and also proves to me that something like this is definately needed.
You are a good man Mark.
Thanks again.
Regards
Suchak Jani
[ March 06, 2002: Message edited by: Suchak Jani ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic