Tony: It was sugested to me that I may have lost marks for not providing unbook functionality.
Jim: Interesting - by whom? Someone with some sort of inside knowledge? Personally I am providing this functionality, but have doubts about it on the other end - is it a good idea?
Jim: It's possible that our emplyer doesn't want users to be able to unbook records.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Here's another check that should be added too(using some common sense):
4. Client3 comes in after Client1 has made the update. Client3 selects the same record for update. Since the record has a client id in the "owner"-field (from Client1s update), he will be notified that the record is already booked.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Your concept is interesting. However do you have a requirement for the lock() method to block until the lock is granted? If you do have such a statement, then client 2 will not get notification that the record is currently locked.
I'd be interested in hearing from others on this. My impression is that most people don't include unbook.
One other concern regarding unbooking: It's possible that our employer doesn't want users to be able to unbook records.
Not a problem for me. When a user searches for records, I display all records that match the criteria, booked or not. So to unbook, they just click un the row and say "unbook", and I look up the record number for that row the same as if they'd clicked "book". The remaining operation is very similar to book, just in reverse.
I won't implement Unbook, but well Undo on books. I agree with 1. and 2. above plus what Jim wrote
I decided to show only records corresponding to bookable rooms and justify it. Do you see any issue regarding the instructions with that ?
"I'm not back." - Bill Harding, Twister
If an employer made a mistake by putting a wrong cutomer ID, for example, it is a task of Aministrator (and therefore administrator GUI) to deal with that,
which is not part of the assignement.
I decided to show only records corresponding to bookable rooms and justify it. Do you see any issue regarding the instructions with that ?
--------------------------------------------------------------------------------
You want to take challenges every time. What for? It is better to show all records and document this decision (no "last minute offers" is required), than to do last mean search and don't provide what is required: search records that match the criteria regarless other facts and restrictions.
Jim:
I'm on Contractors, version 2.1.1.
Jim:
My instructions require that a user be able to search for all records, or records matching a particular name and/or location. Nothing about whether the record has been booked.
Vlad, I just advocate that in our instructions, the "overview" part is as important as the more "technical" ones.
Phil, I don't want to say that your desicions are not reasonable. They are! All what I want to say is that IT developer MUST strictly follow the specification and only do what is EXCPLICETLY required.
It is a part of Business Consultant responsibilities to communicate with the customer about businness flow of your application, not yours.
This document deliberately leaves some issues unspecified, and some problems unraised. Your ability to think through these issues, in the face of realistically imperfect specifications, and come to a tenable solution is something upon which you are being graded.
Marking Criteria
Your work will be evaluated based on the following criteria. The minimum passing score is 320 out of a possible 400 points.
General Considerations (100 points)
Documentation (70 points)
Object-orietned design (30 points)
User Interface (40 points)
Locking (80 points)
Data class (40 points)
Server (40 points)
.if people invited you to attend such a meeting
But reading your point 1...
BTW, does anyone know what the "General Considerations" are in the marking criteria ? It's 100 points, 25% of the total.
Andrew, do you know what they are ?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Just for your info, the old-style exam seems to have the same (bad?) design requirements, although seems to be a bit more explicit about it:
"Writing Data Client
To connect with your server, you should create a client program. This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration."
The Data class is the class containing methods like lock(), unlock(), readRecord() and so on. So I guess they really do want the client to have acces to these
The "Coding Standards" is an interesting issue in it's own right - I am tempted to start a new thread just to talk about it. On second thoughts, no - someone else's turn to start theoretical topics if they want to.
Andrew, the discussion above about what to show on screen in URLyBird (all data or bookable data) is quite important. As you can see, Vlad and I have 100% opposite views and arguments in that area. It would be great if you could tell us (and the posterity ) what are your own thoughts about it.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
And I don't think my comments are soo valuable that you will be changing your designs because of it.
If they are displayed, then if the customer rings up to ask which room they are booked into (or which contractor is coming out) I can manually go through the displayed records and see which record has the correct customer ID number.
In the assignment I did, I showed records that were unavailable. However the user could not do anything with that record.
I think the GUI has to get the unavailable records. Otherwise you are going to have to do some major rewrites if you later need to do anything with them (such as unbook() them). Then whether you display them or not is a design decision - it can be justified either way.
Andrew I think the GUI has to get the unavailable records. Otherwise you are going to have to do some major rewrites if you later need to do anything with them (such as unbook() them). Then whether you display them or not is a design decision - it can be justified either way.
Phil I don't understand what you mean.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Andrew
Sorry I was getting ahead of myself. Those people who prefer the thin client (3 tier) solution could argue that sending the unavailable records is a waste of bandwidth, and they could filter them on the server side. But, as I mentioned above, I don't think this is a good idea, since it will require some major changes to both server and client if a later requirement was to allow for unbook().
Phil
quote:
--------------------------------------------------------------------------------
Instructions:
Your user interface should be designed with the expectation of future functionality enhancements, and it should establish a framework that will support this with minimal disruption to the users when this occurs.
--------------------------------------------------------------------------------
This is probably one of the best parts of the instructions for the 3-tiers advocates : if we decouple the client job from the low-level database job, it's possible to change the db system (to a commercial one like Oracle - quite probable when they'll move to the web) "with minimal disruption to the users when this occurs.". Client code doesn't need to change, and users just need to reconnect to a new server. (BTW, with my sockets implementation which supports call-backs, it can even be done without any disruption to the users at all (by broadcasting a call to a callback method like please_reconnect_to_new_server(newIPAddress, newPort)).
Sorry Andrew, but I cannot follow you there. The more a client will be thin (a web browser is the thinest possible), the less it will need changes if new functionalities come up.
This is probably one of the best parts of the instructions for the 3-tiers advocates : if we decouple the client job from the low-level database job, it's possible to change the db system (to a commercial one like Oracle - quite probable when they'll move to the web) "with minimal disruption to the users when this occurs."
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Alteratively, you could be asking whether we should be exposing the lock() method (and others) via the RMI or sockets connection. In which case we have discussed this a lot in the thread: "Should lock methods be callable by the client". I don't think anyone has discussed that from a security perspective yet
I have a couple of ideas why I think the client should NOT be allowed explicit access to record level lock and unlock methods on the server.
As to what I plan to submit for the project, that is a different story. I have interpreted the instructions as strongly indicating a 2-tier design and that we should make all the methods on the data interface available to the client. So I will allow the client to lock and unlock.
Old instructions:
Writing Data Client:
To connect with your server, you should create a client program. This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration.
I can imagine a new business method "moveBeds" which moves a given number of beds from one room to the other, then I have to do Room 1 (-), Room 2(+) in one indivisible operation.
Now, if the client can lock individual rooms:
1. You increase the probability of deadlocks (for example, locking order differences leading to deadly embrace).
2. The client can mount a denial of service attack on the server by simply grabbing record locks and not letting them go.
I think that a design which allows the client to do implicit record locking is preferable. Note, I still don't think we should have a business method on the server which is doing the locking (I am still a 2-tierer). I guess a database function like the standard "commit" keeps all the record-level locking hidden from the client, and allows the server to make its own decisions. So in an ideal world I would have a different db interface which allows updates to be done within a hidden locking framework - perfect candidate to be a Template pattern kind of thingy.
As to what I plan to submit for the project, that is a different story. I have interpreted the instructions as strongly indicating a 2-tier design and that we should make all the methods on the data interface available to the client. So I will allow the client to lock and unlock.
I was also wondering if the lock cookie value MUST be unique for each lock() call? There could be a higher level of grouping at the transaction level, where all the record locks within one transaction return the same cookie value.
The trouble with Andrew's throwaway comments is that they get you thinking. And then you can't stop. Even when you're busy waiting for the bus, or chewing gum, or anything...
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
However you may not have deadlock handling strategies in place at the moment - in which case you should add them to the server if you wanted to handle this business functionality. But that is a side issue.
Following that side issue for a moment:
Jim made a good case for having deadlock avoidance by forcing locks to be granted to records in numerical order (so you cannot lock records 5, 3, 6 - you would have to lock them in order 3, 5, 6). Such processing adds almost no complexity to your code, and is good for future additions.
quote:
--------------------------------------------------------------------------------
Now, if the client can lock individual rooms:
1. You increase the probability of deadlocks (for example, locking order differences leading to deadly embrace).
--------------------------------------------------------------------------------
All your thin client / 3 tier solution does is move the location where locking is taking place. It has not removed the potential for deadlock.
quote:
--------------------------------------------------------------------------------
As to what I plan to submit for the project, that is a different story. I have interpreted the instructions as strongly indicating a 2-tier design and that we should make all the methods on the data interface available to the client. So I will allow the client to lock and unlock.
--------------------------------------------------------------------------------
To Phil:
The trouble with Andrew's throwaway comments is that they get you thinking. And then you can't stop.
Andrew However you may not have deadlock handling strategies in place at the moment - in which case you should add them to the server if you wanted to handle this business functionality. But that is a side issue.
Phil Side issue ?! Not for all of us !
Andrew Jim made a good case for having deadlock avoidance by forcing locks to be granted to records in numerical order (so you cannot lock records 5, 3, 6 - you would have to lock them in order 3, 5, 6). Such processing adds almost no complexity to your code, and is good for future additions.
Phil Such processing adds almost no complexity to code bases which handle only one table. But for those of us (OK, it could be a majestative "us" ) who designed a multi-table database system, it's not a workable solution.
Deep Now, if the client can lock individual rooms:
1. You increase the probability of deadlocks (for example, locking order differences leading to deadly embrace).
Andrew All your thin client / 3 tier solution does is move the location where locking is taking place. It has not removed the potential for deadlock.
Phil It's not just a move: if locking is handled server-side, it will fully benefit of a try .. finally construct in case of client crash.
Phil Anyway, it's time to publish new ratings. Taking into account that Andrew (2-tiers), as a bartender, has two votes, that Jim (2-tiers), as a Sheriff, has three votes, and that there are 1.5 more tiers in the 3-tiers system than in the 2-tiers one, the new ratings are :
2-tiers : 47.245 % 3-tiers : 52.755 %
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Andrew:
Hmmm - I think you did some creative mathematics there Phil.
Dushy:
But after Tony's result, im skeptic about taking the three tier approach.
Tony:
Well I lost alot of marks on my locking strategy, so maybe the 2 tier gang are right.
Bharat:
Hello Dushyant,
You wrote:
quote:
--------------------------------------------------------------------------------
Hi Bharat,
Nothing could make me more happy than to findout that Sun is not biased towards the Two Tier model for the exam (well.. if i win a million $.. it can make me more happier !!!)
But after Tony's result, im skeptic about taking the three tier approach.
--------------------------------------------------------------------------------
Me too! May be I will go the other way, i.e., with Client side locking. That way the group will have two sample points. I hate being a statistic more that statistics.
Andrew:
We were talking about deadlock, not client crashes.
Andrew:
Client crashes may require more than just a finally clause for clean up. So this benefit (IMHO) is not so great.
Hi Phil, Andrew and others,
I am done with my assignement. I am working on comments and documents right now. I plan to take the test in next two weeks (I have 2 tier design). If I still loose the scores for the locking, I will defently recognize your position that Sun doesn't concern aboaccepts and doesn't penalty 3 tier design.
Let's see...
By the way, sorry guys that I am not active last week in the forum. I just want finally get my assignement done and I will come back to you.
Best,
Vlad
But I found you were quite creative with [Chris & Bharat & Tony's votes]
I am sure that [Tony] lost no point in the locking area because of his 3-tiers design. ... Now with the new assignments, in the improbable case the grader would make you loose points because of a 3-tiers design, there is no logical reason to deduct points in the locking area, or anyway not in the locking area alone.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
I guess I should have closed the thread while it appeared I was winning
Anyway, I have decided that it is a very good idea to implement some kind of deadlock avoidance/detection/handling in the server. But I need to do more research on this area.
Phil, after your post, I read this thread and the instructions yet again but unfortunately, I am tending even more to the 2-tier camp. Sorry!
Originally posted by Andrew Monkhouse:
Your concept is interesting. However do you have a requirement for the lock() method to block until the lock is granted? Usually there is some statement similar to "If the specified record is already locked by a different client, the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked". If you do have such a statement, then client 2 will not get notification that the record is currently locked.
That being the case, if client 1 locks the record and then goes out to lunch, client 2 will be blocked until client 1 comes back.
The problem is that locking isn't just for setting the client ID. You might want to lock a record to delete it. Or (although it is not currently required) you might want to lock a record so you can remove an invalid client booking. So the lock method cannot really care about whether the record has already been booked or not. Plus, depending on your lock signature, you might not be able to indicate that the record has been updated.
(with my numbering)
A CSR selects a contractor to book and hits, say, a 'book' button. At this point, the GUI executes isLocked() on the database. If true, inform the CSR that another CSR is editing this entry. If not locked, test to see if the record is still unbooked. If not, inform the CSR. If the record is not locked and not booked, lock it, and wait for the CSR to type in the client's ID and submit -- which he may now do at his leisure, knowing nobody else will be able to snag the contractor while the CSR is talking to the client. Whether the CSR books or cancels (timeouts are not handled well in this scenario) -- the record is finally unlocked for other CSR's to eye.
the comments specifically state that locking is only meant to prevent writing by different clients. But what about a thread that's mid-read when another thread comes along and rewrites the record?
Well, The requirement that lock() blocks until the lock is granted is an emergency specification only: my interface contains a boolean isLocked(), which is what the GUI ought to be using.
I'd rather have flaky high level locking in the GUI than server-side data corruption!
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|