• 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

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

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic