File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes I changed the signature of lock and unlock methods in Data class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "I changed the signature of lock and unlock methods in Data class " Watch "I changed the signature of lock and unlock methods in Data class " New topic
Author

I changed the signature of lock and unlock methods in Data class

G.T. Reddy
Ranch Hand

Joined: Jun 25, 2002
Posts: 45
Hi everybody,
In my FBN application I changed the signature of the lock and unlock methods as
public synchronized void lock(Object owner, int record)
public void unlock(Object owner, int record)
But in the instructions it has been given as "Record locking must be implemented using the methods public void lock(int) and public void unlock(int)".
is it acceptable?.
please clarify me.
Bernhard Woditschka
Ranch Hand

Joined: Sep 16, 2002
Posts: 89
I think this is not acceptable, as it becomes harder to use the API.
You cannot simply call lock(10); anymore the user of the API now always has to pass in some identity.
I prefer aproaches that somehow behind the scene "detect" the users identity like the thread in local mode or a remote identity in remote mode.
Bern
[ January 18, 2003: Message edited by: Bernhard Woditschka ]
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by G.T.Reddy:
is it acceptable?
If this question means "can I pass with this?" then the answer is "yes". There have been plenty of participants in this group over time who did something similar and passed.
If the question means "is this solution as good as any other?" the answer must be "no". It is possible to fulfil all requirements without changing the method signatures and without really complicating your architecture. That alone would make such a solution preferable in my book -- of course, as pointed out above, the API would also be easier to use that way -- and assessors are likely to rate it higher than the solution you presented.
- Peter
[ January 18, 2003: Message edited by: Peter den Haan ]
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Originally posted by Peter den Haan:
If this question means "can I pass with this?" then the answer is "yes".


Actually, that is answer is 'maybe'. The Sun people that I've spoken to take a dim view of this sort of thing, even as some of them have let it slide in the past. Will they continue to let it slide?
Maybe.
Generally, it's a good idea not change the signature, because that steps around the problem they had intended for you to solve.

All best,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4
[ January 18, 2003: Message edited by: Max Habibi ]

Java Regular Expressions
Matt Ghiold
Ranch Hand

Joined: Feb 24, 2002
Posts: 213
If the question means "is this solution as good as any other?" the answer must be "no". It is possible to fulfil all requirements without changing the method signatures and without really complicating your architecture. That alone would make such a solution preferable in my book -- of course, as pointed out above, the API would also be easier to use that way -- and assessors are likely to rate it higher than the solution you presented.

Ok, Peter, you convinced me, im going to go rewrite my backend =). Shouldn't be to bad though.
Thank's for all your insights...
I think I was taking the "pass" route :roll: , instead of the let's kick the sh-t outa this test route.
thanks again!


-Matt<br /> SCJP2<br /> SCJD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I changed the signature of lock and unlock methods in Data class