• 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

Loading the Client

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For my application prototype I use a 'driver' class to instantiate the model, view and controller. There is also code that presents the user with a connection option dialog.
Did anyone else use this approach or was this type of code written in the client (view)?
Thank you for your comments.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you just mean a main class, the one class that ahs a main method and that is the class that starts the client? Call it an application class maybe.
I had that and the rest of your description sounds like a number of solutions that others have used.
Mark
 
Christian Garcia
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark,
Thanks for the response. I am using a single class that contains the 'main' method as the entry point into my app. From what I've read here at the Ranch there are statements that lead me to believe that the startup code is written in the View/GUI. That didn't seem correct, so I was just making sure.
 
Christian Garcia
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more question: Did you pre-populate the JTable when you're app was loaded? If not, did you wait for the user to perform a search and then load the JTable?
I'm thinking that I shouldn't pre-populate b/c of the potential number of records that could be in the database.
Please advise.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I have gone way overboard, but I have gone for a Heirachial Model View Controller approach, with my startup code in the first controller:

As you can see, the controllers are all linked, and each controller is in charge of one model and one view.
The five modules are:
Main: sets up the JFrame, menus, etc
Options: connection options etc
Availability: seats available, search criteria
Booking: number of seats requested
Help: display online user help
Options, Availability and Booking are just JPanels which are displayed in the Main JFrame.
The help module displays in it's own JFrame (and can also be run as a seperate application) - it just displays the HTML user help which the user can view using their own web browser if they prefer.
Availability and Booking both use the same model.
I decided to make a seperate JPanel for the user to enter the number of seats rather than creating an dialog box (I have reasons ).
The code is clean and easy to understand, and I am enjoying writing it, so I am leaving it in at the moment, even though it appears that I am doing far more than required . Unless of course someone here gives me a good reason to stop this and go back to a more standard approach.
Regards, Andrew
[ April 29, 2003: Message edited by: Andrew Monkhouse ]
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Christian,
I pre-populated my table before displaying the availability screen. I have gone with the specified statement that FBNS "provides flight information on a small selection of routes and carriers". If the situation changes, this could be redressed.
I have also documented my decision (of course ).
Regards, Andrew
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Christian,
Somehow I left off the reason for my HMVC post ... the answer to your question about what Class is your entry point to the application.
If you consider it from the perspective of a HMVC, it should (I hope) be obvious that the entry point should be one of the controllers.
An MVC is just a cut down HMVC (or a HMVC is just a glorified MVC ) so the same rules apply: start at a controller which will control the creation of the model and the view.
Regards, Andrew
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Christian Garcia:
Mark,
Thanks for the response. I am using a single class that contains the 'main' method as the entry point into my app. From what I've read here at the Ranch there are statements that lead me to believe that the startup code is written in the View/GUI. That didn't seem correct, so I was just making sure.


Yes, I too had a class like that. I called it FlyByNightAirlines.java
It only has a main that instantiates the client classes.
Mark
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Christian Garcia:
One more question: Did you pre-populate the JTable when you're app was loaded? If not, did you wait for the user to perform a search and then load the JTable?
I'm thinking that I shouldn't pre-populate b/c of the potential number of records that could be in the database.
Please advise.



I think either way is fine.
Mark
 
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Christian Garcia:
One more question: Did you pre-populate the JTable when you're app was loaded? If not, did you wait for the user to perform a search and then load the JTable?
I'm thinking that I shouldn't pre-populate b/c of the potential number of records that could be in the database.
Please advise.


Cristian, you can have the best of both worlds with very little code, I pre-populate the JTable because it looks odd empty on startup, but I limit the number of records on startup to 100 by overloading the method to take max number of rooms, theres much less than 100 in the database so you'll see everything as it stands now, but if the database was bigger there wouldn't be a problem.
I thought about allowing the user to configure preferences like that one but changed my mind because thats just going too far with this, for the same reason I changed my mind about allowing the user to decide whether he wants his JTable updated everytime some other client changes it, I ended up not implementing remote notification at all, its not asked for so I wont give it.
 
Christian Garcia
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for the responses.
After reading these posts I've decided to keep to my original design and use my "startup class" to kick off the application. As for the GUI, pre-populating the JTable works for me. That's how I designed and coded my prototype. I just wanted to get some outside opinions to save points from being deducted.
[ May 03, 2003: Message edited by: Christian Garcia ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic