• 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

passed 151/155!!!

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
I got my results really fast - uploaded the assignment on June 21, took the essay exam on June 26. Here are my results:
Grade: P
Score: 151
Comment: This report shows the total points that could have been awarded in each section and the actual number of points you were awarded. This is provided to give you per-section feedback on your strengths. The maximum possible # of points is 155; the minimum to pass is 124. General Considerations(maximum = 58): 58 Documentation(maximum = 20): 18 GUI(maximum = 24): 24 Server(maximum = 53): 51
I want to thank everyone at JavaRanch for their assistance. I could not have done this without this forum, since I only really learned Java this year (old COBOL programmer), and I have not had an opportunity to use Java on the job.
My successful actions:
I made sure that I really understood every word of the specifications. As I moved through the assignment, I would reread the specs and discover areas where I had not previously really understood what was required, but now it made sense.
For each major programming hurdle, I studied the posts on this forum to learn from those who had gone before.
I didn't give up. (Probably the biggest contributor to my score.)
These were the major design decisions:
Implemented RMI for the network connection.
Implemented the MVC pattern for the overall architecture of FBN.
I had a LockManager class.
I modified the Data class.
I had a custom Table Model for my JTable.
Thanks again to you guys,
Debra Bellmaine
SCJD2
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"awesome" to "quite awesome" Nice to see a name that has been on posts I've read make it to the finish line in high style.
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very impressive score, congratulations.


Implemented the MVC pattern for the overall architecture of FBN


Would you please comment on your MVC implementation? I am especially interested as to how your controller took the values from the GUI when it needed it. For example, if the user clicks the "Search flights" button, the controller handles the action. But how does it retreive the "origin" and "destination" from GUI, without referencing specific swing controls?
Also, I am curious if you modified the ignatures of lock/unlock and if you did locking in local mode.
Thanks,
Eugene.
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eugene,
Happy to discuss MVC. The listeners registered with the components in the GUI class are actually declared in the View implementation class, and the references are passed to the GUI to be registered. When the Search Flights listener (in the View) receives the event, it fires a method in the Controller, passing the String criteria. Before invoking the method in the Controller, the View invokes methods in the GUI class in order to obtain the values selected by the user from each JComboBox. The View then strings the info together into the String criteria, and passes it to the Controller, which invokes the criteriaFind method. The Controller knows nothing about the GUI class - it only talks to the View and the Model (Model is an interface, implemented by Data.) All communcation to the GUI class goes via the View.
With regard to the lock/unlock signatures, I left them unchanged, and I left the lock/unlock methods in Data empty. I implemented the locking via a LockManager class. In local mode, the client invokes methods directly on Data, whose lock/unlock methods remain empty. I didn't want the client to have to be aware of mode, after the initial startup. So, the client does always invoke lock/unlock, but locking only really occurs in networked mode.
Hope this is helpful.
Best,
Debra
[ July 01, 2002: Message edited by: Debra Bellmaine ]
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your detailed response. I have a few more questions for you:


The listeners registered with the components in the GUI class are actually declared in the View implementation class, and the references are passed to the GUI to be registered.


So your view is actually separate from your GUI, right? For some reason, I assumed that view is the GUI.


When the Search Flights listener (in the View) receives the event, it fires a method in the Controller, passing the String criteria.


Does it mean that the view has a reference to controller? I thought that the view should not know anything about the controller.


Before invoking the method in the Controller, the View invokes methods in the GUI class in order to obtain the values selected by the user from each JComboBox.


What happens if the GUI control that holds the value changes (say from combo box to text field? That will mean that both the GUI and the view will have to change, right?


(Model is an interface, implemented by Data.)


That's interesting, I didn't think of Data as a model, but rather a service. In my implementation, the Model is the application state, as determined by some critical values, such as number of seats to book, origin, destination, selected flight, etc.
Thanks,
Eugene.
 
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
Congrats Debra, great score and well done.
Thanks for posting your design choices.
I am going to move this to the Certification Results forum so that more people can congratulate you and learn from your accomplishment.
Mark
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great Score, Congrats Debra,
I have a question about GUI design,It seems you got all score for this part. Did you use one Frame to show your Searh criteria (combobox),result and booking ? can you give us a hint? thanks.
Sam
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Debra
Congratulations, it is the score one dreams of... I never saw a higher score.
I would like to have your advise on two things. Did you implement a thread cleaning up locks of dead clients? And also, did you use a rmi code base? Or did you provide de sub and the interface in the client jar?
Thanks in advance,
/Hugo.
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eugene,
I took Sun's Java Programming Language Workshop (SL-285), which is the course where MVC is taught for Java. The classroom project was very similar to FBN, and I modeled my implementation on what I learned in that course.
For my app (and the class project), the class that starts up the FBN system does three things:
1. Get a reference to a Model (either remote or local, since we have to go either way).
2. Instantiate a View, passing the Model reference to the View constructor, as the View does state queries against the Model directly.
3. Instantiate a Controller, passing the Model and View references to the Controller constructor.I'll try to recreate the MVC diagram that I learned in the Sun course:
The line going from Model to View, noted as
"Change notification," is the Model firing a notification of a state change to all registered Model listeners (Views - can be more than one, stored in an ArrayList). The line going from View to Controller, noted as "User gestures," is the View firing a notification of a user-event to all registered View listeners (Controllers - can be more than one, stored in an ArrayList).
View directly can invoke methods in Model to query the current state, and Controller can directly invoke methods in Model to initiate a state change. Controller can also directly invoke methods in View to direct the View selection.
From this you can see that View must have a reference to Model, and Controller must have a reference to both View and Model. Model does also have a reference to all listening Views, for the purpose of change notification, and View likewise has a reference to all listening Controllers, for the purpose of user gesture notification.
I suppose that the View and GUI could be combined, but a GUI is inherently sufficiently complex that it is a better approach to split out the GUI from the View, and reduce the degree of coupling between objects. For example, I could completely redesign the user interface without making any change to the View code.
Incidentally, each component of the MVC implementation is an Interface, with a corresponding implementing class.
To answer your question:

What happens if the GUI control that holds the value changes (say from combo box to text field? That will mean that both the GUI and the view will have to change, right?


The View doesn't care what values the user specifieds in any of the JComboBoxes until the user hits the Search button, toolbar item, or menu item. Then the View invokes the methods in the GUI to determine what the current selection is in each combo box.
Regarding the last point about my Model interface being implemented by Data, again this was the example used in Sun's class. Their definition of Model is:

Represents the application data and the business rules that govern access and modifications of this data.


That's pretty much what the Data class is already doing, so I just created an Interface, and away I went.
Hope I have answered your questions...rereading my answers, they sound a bit professor-ish, but since I had the benefit of Sun's official viewpoint on MVC, I thought it might be helpful to others.
Best,
Debra
[ July 01, 2002: Message edited by: Debra Bellmaine ]
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sam and Hugo,
Sam's question first:

I have a question about GUI design,It seems you got all score for this part. Did you use one Frame to show your Searh criteria (combobox),result and booking ? can you give us a hint? thanks.


I had one JFrame, with a menu and toolbar. The frame contained a JSplitPane. The GUI components for specifying Origin, Destination, and Carrier were in the top half of the split pane, along with a Search button. The bottom half of the split pane contained my JTable. When the user has selected a flight in the table that has seats available (seats > 0), the Book Flights tool and menu items are enabled. Selecting Book Flights brings up a JDialog, in which all the flight data is again displayed and the number of seats can be specified by the user.
Hugo's question:

I would like to have your advise on two things. Did you implement a thread cleaning up locks of dead clients? And also, did you use a rmi code base? Or did you provide de sub and the interface in the client jar?


I did implements a thread to clean up dead locks (defined as locks older than 10 seconds). This is implemented as an inner class in the LockManager class. I did not use RMI code base, I started the RMIRegistry from within the code, and I did put the stub and interface in the client jar. I also had a server GUI, but it's only function was to provide graceful shutdown of the server. I used the command line to pass arguments at startup.
Debra
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Debra,
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Debra,
Sorry about asking many question,
In my instruction, the paramater for criteriaFind is a string which should contain Carrier and Origin, for example "Carrier='SpeedyAir',Origin='SFO'" ,now question is :Can I add Destination Field (as you did and makes more sense to book a flight) in my string ??
Thanks
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sam,
My specs said the following:

The user should be able to select the origin and destination of flights, and the display should update to show only flights that satisfy those criteria. The user must be able to describe enter the string value "any" for the origin, destination, or both, so as to implement a wildcard-like feature.


If this is the same as your specs, then you must allow the user to specify both origin and destination. My decision to also include carrier was based on the example given in the specs:

"Carrier='SpeedyAir',Origin='SFO'"


This appears to contradict the other reference, but I figured what the heck, why not just do it all? Makes the GUI more interesting, and is more realistic.
Debra
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sam,
Also, feel free to ask all the questions you want. I got so much help here at JavaRanch, it's the least I can do to turn around and help others.
Debra
 
Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Debra,
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congrats Debra!!
Excellent score, and great explanation of MVC.
Mike
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Debra,
Thanks again for your detailed response. I have one more question for you. Did you use Observer/Observable interface to implement the communication between the model and the view, or some other mechanism?
Thanks,
Eugene.
[ July 18, 2002: Message edited by: Eugene Kononov ]
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good job Debra
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Debra Bellmaine:

With regard to the lock/unlock signatures, I left them unchanged, and I left the lock/unlock methods in Data empty. I implemented the locking via a LockManager class. In local mode, the client invokes methods directly on Data, whose lock/unlock methods remain empty. I didn't want the client to have to be aware of mode, after the initial startup. So, the client does always invoke lock/unlock, but locking only really occurs in networked mode.


Hi Debra my locking design is somewhat similar to yours. I also have a lock manager for RemoteDataAccess while Data.java (modified and not extended) has lock and unlock methods are empty. However i am bit confused about explaining and defend this in DesignChoice.txt. How did u do explained it ?
Actually the problem is to answer one of the essay exam question that is "Did u extend or modified Data.java and why ?"
My answer to this that i think lock and unlock and criteria find methods are intergal part of any database system and thus they should be in Data and not in its subclass. According to me subclassing means adding an extra layer on exisitng fuctionality.
My this answer is contradicting the design of having lock and unlock methods empty.
Pls Help
Amit
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, Debra, congratulations for your high score!
I have a question, as your view has referrence of GUI and Model, and Control, When the Search Flights listener (in the View) receives the event, why bothering to invoke method in the Control, I am curious about in which case did your view interact Model(as you said, Data) directly?
could you tell us how you defend your GUI in your design choice?
Thanks again!
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all:
I've read through most of the previous posts and I find out that most experts advise that there should be a 'ConnectionFactory' object. It seems to me that it is used becuase they want to invoke lock method using like 'lockManager.lock(id, this)', where 'this' refers to the connection object instance. So record is associated to a client when locking.
But my question is why do we need to associate a record with a client for locking? Since a client can modify a record only after calling 'lock' then when 'unlock' is invoked on that record, it should be only the currect client who issues the command, and no one else can invoke 'unlock' before retrieving 'lock'. Am I right? So, in my program, why cann't I just grant the 'unlock' operation without checking the client ID?
Anyone pls kindly help me.
Thanks.
cindy
 
Gosling Gong
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by cindy sung:
Hi all:
I've read through most of the previous posts and I find out that most experts advise that there should be a 'ConnectionFactory' object. It seems to me that it is used becuase they want to invoke lock method using like 'lockManager.lock(id, this)', where 'this' refers to the connection object instance. So record is associated to a client when locking.
But my question is why do we need to associate a record with a client for locking? Since a client can modify a record only after calling 'lock' then when 'unlock' is invoked on that record, it should be only the currect client who issues the command, and no one else can invoke 'unlock' before retrieving 'lock'. Am I right? So, in my program, why cann't I just grant the 'unlock' operation without checking the client ID?
Anyone pls kindly help me.
Thanks.
cindy


what you said is correct, and it's the ideal situation. I did see some guys passed without track the client. but for better usability, it's necessary to do so, since you can not guarantee your client always work properly as you think. and, more, the spec say you must fulfill that unlock will be nothing when this record is not locked by current client.
try to search using "Lock" on the certification forum you will get full info on this.
 
cindy sung
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gosling:
Thank you very much.
Can you kindly please give me one example when a client would invoke 'unlock' before 'lock' is performed?
Thanks.
cindy
 
Gosling Gong
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by cindy sung:
Hi Gosling:
Thank you very much.
Can you kindly please give me one example when a client would invoke 'unlock' before 'lock' is performed?
Thanks.
cindy


one case will be your client didn't get lock successfully( some exception occur), but it still executes unlock.
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eugene, Gosling, Amit, Cindy,
First, I have to apologize. I have egg on my face. In reviewing my FBN code, it does not exactly conform to the diagram above in that I removed the code that registered a View listener with the Model.
In the classroom project that we did, Sun had used the Observer/Observable pattern (but not the interface or class) to allow the Model to immediately notify all Views of state changes. I really thought this was cool, and wanted to do this, but was discouraged by some wise JavaRanch participants, as the specs definitely state that this is not necessary.
If I had implemented FBN exactly per Sun's example of MVC, I could then explain that the manner taught by Sun of enabling communication between the View and Model when implementing the MVC pattern architecturally is thus:
1. When the View is instantiated, it is passed a reference to Model, which it stores in an instance variable for later use. If View needs to invoke methods directly on Model, it uses this value to reach the Model.
2. When the View's constructor is executing, it uses the Model reference to invoke a viewListenerRegistration method, passing itself as an argument. The Model would store the reference in some type of Array. When later some state changed in the Model, it would invoke a method in itself that would loop through the Array and notify all listening View's of the state change, so that they could respond or not, as each View decided.
As it happens, I took out all the state-change notification logic from FBN, including the code where the View registered itself with the Model. I do still have the Model reference stored in the View.
Now, as to when my View invokes methods directly on Model. In my implementation it currently does not, but I still need the reference as this would very likely change as FBN was extended into a more full-function travel service.
In order for the data presented by View to be updated, there are two ways it can get the info. It can "pull" the data by querying the Model, or data can be "pushed" to the View by Model or Controller. If you look at the diagram again, you see the line where Model notifies the Views of a state change, and this notification might, or might not, include the new data. If it only informs View that there was a change, View will have to query Model to actually update the data it is presenting. Similarly, when Controller directs View to give a particular presentation, it might pass the data to View, or it might just tell View to show window X, and it is then up to View to get the most current data for the population of window X.
In the case of my FBN implementation, the Controller passes ("pushes") the data to the View, so View currently gets away with not having to directly query Model, but who knows in the future when FBN is extended?
Amit, I will address your question on lock/unlock and the modify/enhance issue. First, bear in mind that 2 of the 4 points I lost was on the Server, so I didn't get a perfect score in this area. Second, I would not be helping you if I tell you how to answer the essay question. But, I will tell you some of the thoughts I had on this:
1. I didn't get to write the original Data class, but I had to use what was already there, although clearly (per the specs) it is not implemented code as it is given to us for the FBN project. As such, I considered that Data was fair game to be changed, and that this was the simplest way to accomplish what was needed.
2. I didn't think the client should have mode-specific code after startup. It shouldn't care about which mode it is in, but always do the usual actions of lock/read/update/unlock.
3. The lock and unlock methods aren't actually empty, they are just implemented elsewhere, in my case, in LockManager. There's got to be some workaround here, because the specs tell you to only allow the locking client to unlock a record, but the method signature does not allow the passing of any client identifier. Some people have selected to modify the signature, but I liked the elegance of combining the ConnectionFactory concept with the need to identify the client uniquely for lock/unlock.

Also, I didn't defend my GUI. I've been developing GUIs for 12+ years, and I thought my FBN GUI was pretty slick. It was intuitive for the user, asthetic, and efficient to use, so I figured that if the examiner couldn't see all that, I hadn't really accomplished what I consider to be the main point of a GUI: to allow a user to easily and comfortably be in communication with the computer, and enjoy the tasks he needs to perform.
Hope that helps. I didn't understand anything at all about ConnectionFactory or LockManager until a few weeks ago, but there was a lot of help to be had on the Developers Cert forum. (And I always checked on the score of those giving advice - I like to listen to the ones who demonstrably know their stuff.)
Cindy, I believe Gosling has already addressed your questions regarding the unlock issue. I agree with his assessment.
Good luck everybody. It was really fun doing this assignment, and I took Peter's advice and really wrung from it all the learning that I could. Before I did this, I knew Java syntax, but I didn't really feel that I knew how to build a system. Now I now how to approach this, and I have much more confidence in my level of expertise. The other thing I really learned was how to learn how to use the various classes provided in the JSDK. I must have spent 3/4 of my time studying the Platform API Spec online. There really are a lot of very interesting classes and interfaces of which we can make use.
All for now,
Debra
SCJD
 
Gosling Gong
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, Debra!
two more question, if you didn't implement Observer pattern, how did you make the Toolbar and menu item status changed according to the flight info which user clicks?
did you use action when create menu item and toolbar? You said the listener for action is in your view, so you have some hook methods in your gui, and in your view you just call those hook methods to assign listener to the gui components, as what Mark did?
 
Amit Kr Kumar
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Debra
Thanks for the quck reply. As per what i understand, your assignment solution has the fdollowing feature:
1) You have lock and unlock method empty in Data.java
2) In your connection which is generated by connection factory is unique to each remote client and they also have lock and unlock method which then delegate the call to LockManager which maintains a hashmap kind of collection with record no as the key and connection object as the value.

Am i right ?
If this is the case what should be the javadoc for lock and unlock methods in Data.java which are empty and doing nothing. Is it something like "This method do nothing". Is this ok ?
Actually what is worrying me the most is how to defend leaving the method empty.

Regards
 
Hugo van Elk
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Debra
Very kind of you to answer all our questions.
The discussion on MVC is realy an eye opener for me.
For the criteria search, you let the VIEW ask the CONTROLLER to fetch the data from the model. Now I am trying to understand you model, I was wondering whether it could be ok to let VIEW ask MODEL directly to perform the criteria search. This seems ok with the model, going over the 'State query' line.
Is that true, could the VIEW ask the MODEL instead of the controller to perform the search?
/Hugo.
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gosling, Amit, & Hugo,
As far as my enabling/disabling the tool and menu item for Book Flight, I had a ListSelectionListener for my JTable (actually it gets registered to the selection model). When the list selection changed, I queried the table model to determine what the value of "seats" was for the row, and enabled/disabled accordingly. And yes, I did define Actions for all menu/toolbar/button items, declared in the View, and passed to the GUI.
Amit, you have hit the nail on the head with regard to the lock/unlock scheme. As to defending your design decision, what I would say is this. If you are not certain about how to defend it, then you are not sufficiently certain about the correctness of your approach. Once you yourself are completely convinced as to the appropriateness of your approach, it will be easy to explain to someone else - you just simply tell them why you believe it is the right way to do it. I suggest spending some more time reading and rereading the posts in the forum on lock/unlock, LockManager, and ConnectionFactory, and draw some diagrams of how this all goes together. I don't mean to be hard, or unhelpful, but this is one of the areas where you really need to work this out yourself so you have certainty.
Hugo, with regard to the View directly invoking criteriaFind on the Model, you could do this, however the Sun approach was to have the View inform the Controller of all user gestures, so that the Controller could decided how to deal with the gesture. As the name Controller implies, it is intended to be a control point for the system, almost like a traffic cop between the Model and View. I went ahead and split it out this way for this reason, although in truth it does add more methods and code to have the View notifiy the Controller, then the Controller tells the View to do such and such, etc. However, when you consider a much larger application, perhaps a multi-user accounting system deployed over a network in a medium to large business, there will be lots of different Views and Controllers all in that one app. One View may deal with Purchase Orders, and the other handles Accounts Receivables. By creating a real dividing line between the Model, View, and Controller, each piece is more readily extended when enhancements are requested, without affecting the others, and that addresses one of the other project requirements:

Your user interface should be designed with the expectation of future functionality enhancements, and it should establish a control scheme that will support this with minimal disruption to the users when this occurs.


Happy coding,
Debra
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Debra wrote:
When the Search Flights listener (in the View) receives the event, it fires a method in the Controller, passing the String criteria.


Debra,
I am still missing one critical detail: in order for the "Search Flights" listener in the View to call a method in the controller, the view must know about the controller (have a reference to it). Doesn't that go against the MVC paradigm? That is, the controller should know about the views, but not vise versa.
Please comment,
Eugene.
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eugene,
No, the Controller(s) actually register themselves as listeners to the View. The Controller invokes a method in the View implementation class, passing itself as the argument, to register itself. The View stores each registering Controller in an ArrayList. When there is a user gesture (user-event), the View loops through all Controllers and notifies them. It could be that there is more than one Controller, but that only a particular Controller is interested in a specific gesture, and so that Controller will act upon the gesture notification.
I hope that this makes sense. Everything I know of the MVC pattern is from the Sun class I took, so it is possible that there have been other implementations, as the patterns are not language-specific.
Best,
Debra
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


When there is a user gesture (user-event), the View loops through all Controllers and notifies them.


I think I am finally starting to understand this. You must have something like this in your code:

Is that right?
Thanks again,
Eugene.
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eugene,
You've basically got it, although my code was split up a bit more. I declared the listener or action in the View, with as anonymous inner class, as you have. But I assigned it to an instance variable of the action type, and passed it to the GUI, where it was registered with the component. And, I had a method in View that strung together the search params in the String criteria, which was then passed to the controller(s). But, overall you've got the concept.
Debra
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Debra,
It all now makes sense. This scheme actually supports "multiple models - multiple views - multiple controllers" implementation. I would call it a "MMMVMC" instead of "MVC". The drawback that I see is a number of additional interfaces neccessary to notify the listeners. But I guess that's a small price to pay for the reusability.
Eugene.
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah that's an amazing thread.
First things first. . Congratulations Deb !
To Moderators :: Why is the text spreading and causing big horizontal scrollbar in the browser window? I think someone added PRE element, please try to remove it to cause better readability.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congratulations Debra!! great score!! I have a question about db.db. Did u use any other table? or ur application has only one table (db.db) provided by sun?
Please give light on this issue.
Thanks
 
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
The text is spreading becuase someone in this thread posted code that did not have carriage returns/line feeds.
This happens also if you copy and paste someone elses code in a post. For instance in this case Eugene had copied Debra's "UML" document she had posted. When he copied and pasted it, it no longer had carriage returns. This is caused by UBB and the web browser and what it copies to the clipboard when you highlight something here.
They can edit their post and put returns in there and it will fix everything.
Mark
[ July 08, 2002: Message edited by: Mark Spritzler ]
 
Debra Bellmaine
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nagu,
Thanks for the congrats. To answer your question about the table, the Fly By Night application uses only one binary file, called "db.db," which is provided by Sun and cannot be altered as to form. This file must be used for the project, and I'm not aware of anyone adding any additional files/tables to their implementation of the project - it's completely unnecessary. Hope that helps.
Best,
Debra
 
Nagu Rathina
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Debra. It is clear now.
 
Hugo van Elk
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Debra
I would like to thank you for explaining the MVC design. After I redesigned my gui using you ideas, it looks much better!
/Hugo.
 
reply
    Bookmark Topic Watch Topic
  • New Topic