This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Though I do not have any problems implementing locking in whichever way it is required, I want to seek your advice. My assignment says "Part of your assignment will be to enhance the Data class. You may do this by modification or subclassing, but you should document the approach and reason for your choice. ". I did not subclass the Data class. I modified it to implment the criteriaFind(). I have an adpater class for the Data class and this adapter does locking and unlocking with the help of the LockManger. Every client will get a seperate instance of adapter which has a reference to single instance of the Data object. First of all, are there only two choices which are 'accepted' for locking, either subclass or modify ?. If yes, ignore the next paragraph please. If this is okay, now, if I get a question like "Did you subclass or modify the data class to implment locking ?' how do I answer ?. [ March 15, 2002: Message edited by: Rajesh Matti ]
Rajesh, I myself decided to "Adapt" the Data class for locking and Unlocking ... If I get a question like that in the exam, I would answer like this : "I neither modified or extended the Data class ... I used Composition/Adapter ... blah ... blah ..blah .."(Reasons for Adaption) But, I am not an SCJD yet ...I would appreciate if someone with an SCJD and who took this approach helps us ... Regards, Krishna Varma
Rajesh Matti
Ranch Hand
Joined: Jan 07, 2002
Posts: 121
posted
0
Krishna- That is exactly I would answer, but look at the question, if you are asked 'Did you subclass or modify', I assume the answer to be one word.
Hi I was thinking of modifying the Data class for implementing the lock / unlock because I need to have some additional methods for lock / unlock. I reached this decision after posing my query for lock and unlock on this forum. I personally would not like to touch any classes given by the Sun and rather would extend the class to give whatever desired behaviour I want for a method. Thanks -- Ravindra
SCJP, SCJD, SCWCD, SCBCD, SCEA
Rajesh Matti
Ranch Hand
Joined: Jan 07, 2002
Posts: 121
posted
0
janapareddy - The issue is not whether to modify or subclass the dataclass, but, is about doing neither of them !!! [ March 15, 2002: Message edited by: Rajesh Matti ]
Rajesh, I believe you have modified the Data class right? You see when you change the deprecated methods from within Data or add the criteriaFind functionality, you are automatically modifying data. You woudnt have to do this if you extended Data and deprecated the faulty methods and provided your criteriaFind in the extended class.The methods lock and unlock need not really be concerened with the question. I beleive you have modified and not extended Data and you should state the same. I doubt they will ask you a question like "Did you implement locking by modifying or extending data?". Anyway this is my 2c. Enjoy bud.
Never be satisfied with anything less than the best and you will surely pass the test...
How are you handling the existing code that uses deprecated methods? If you aren't touching Sun's code then what are you doing? I suppose you could extend the Data class and override the methods, but then there's still code that uses deprecated methods. If you just fix the methods of Data that call deprecated methods and subclass it to handle locking or criteriaFind, then haven't you modified *and* extended the class? Seems to me that if part of the task is to remove calls to deprecated methods you MUST modify the Data class, however slightly. And, technically, if you add the required javadoc comments you've modified it even more - at least that's what any decent revision control system would tell you. It's a puzzle I've yet to find a clear answer for . Maybe there isn't one and anything you can make a good enough case for is acceptable. :roll: If there's anybody with an answer they wan to debate, please put it out here so we can see who shaved the barber.
Originally posted by janapareddy ravindra: I personally would not like to touch any classes given by the Sun and rather would extend the class to give whatever desired behaviour I want for a method.
:roll:
SCJP, SCJD, SCEA 5 "The only rules that really matter are these: what a man can do and what a man can't do." Captain Jack Sparrow
Rajesh Matti
Ranch Hand
Joined: Jan 07, 2002
Posts: 121
posted
0
Kalichar- While I appreciate your 2 cents, dude, I am talking in the context of lock mechanism, i did change the data class to implement criteriaFind(), changing data class to fix the deprecated methods do not qualify for subclassing or enhancingc the data class. I think modifying should not be taken literally in programmer's world, rather should be taken towards enhancing or subclassing. Hope you understand better...
Rajesh Matti
Ranch Hand
Joined: Jan 07, 2002
Posts: 121
posted
0
Burk - When I said modify or subclass it applies to criteriaFind() and lock mechanism. Hoping that you understand what I meant, please give your opinion, I am not for a debate here, as I am not interested in one. Thanks, -Rajesh
Kalichar Rangantittu
Ranch Hand
Joined: Jan 15, 2002
Posts: 240
posted
0
Well Rajesh another of my 2c. There is a part of the exam requirements doc that leaves certain areas open for your own design. Just because modifying or extending Data are common choices to handle locking mechanism neeed not meet they are the only way. If I were you, I'd stand by my descision and say, "I neither modified Data nor did I extend it. Instead I provided an Adapter that handled the locking mechanism for the database." If you didnt modify or extend Data to design ur app, well that is definitely a design choice made by you and as long as you can justify why u did it, I am sure the examiner would appreciate it. Hope this helps. Good luck dude...enjoy.