This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

public interface DB

 
paul seldon
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to me not all methods are about to use this assignment.
All the methods regardless of using it or not for this assignment,
have to be full-fledgedly coded? or only the one is about to use.
And the rest which is not going to implement for this assignment,
just put return 0 or return something appropriate for that particular methods spec and leave it.

Let me know.
 
josine wilms
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

All methods have to be implemented. The methods that are not going to be used in the final application are useful for testing purposes .



 
Kai Witte
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

where did you get that information, Josine?

Many people, including me, did not implement them. In that case the best way would be to throw an UnsupportedOperationException instead. As far as I know, all of us got very high scores. I got 96 %.

I had B & S.

Kai
 
josine wilms
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean I think all methods have to work technically( throug Sun's Data.java class which implements the DB interface) , but not all methods are accessible by the client GUI (create() for example).

If you didn't supply working code in the Data.java for these methods I would be surprised and happy to know?

I have Urlybird 1.2.1

Thnx!
Josine
[ October 29, 2006: Message edited by: josine wilms ]
 
Kai Witte
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

as you requested I herewith confirm my previous post: I implemented some of the methods by throwing an UnsupportedOperationException.

Kai
 
Rahim Nathwani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am working on UrlyBird 1.1.1

The assignment says Data must implement interface DB.

So in my data class i have a method:
public int create(String[] data) throws DuplicateKeyException{}

I really like Kai's idea of throwing a UnsupportedOperationException instead of accessing the file and creating a record etc....

Do I break any rules is I change the mothod signature in Data.java to:
public int create(String[] data) throws DuplicateKeyException,UnsupportedOperationException {}

I was under the impression that I can't mess with the method signature if it comes from interface DB. I think I might be misunderstanding this

Thanks
 
Kai Witte
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

an exception which is declared to be thrown using the throws clause is not part of the signature in terms of the JLS or the VMS. Besides it is considered bad practice to declare RuntimeExceptions in the throws clause.

I do not recommend to declare UnsupportedOperationException to be thrown using the throws clause.

There are many, many threads about different people who avoided a typical implementation of those methods with different ways.

Kai
 
Rahim Nathwani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kai,

Can you suggest a way I can do it?

Thanks
 
Rahim Nathwani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind Kai - I figured it out

Thanks for the help
 
Jeremy Botha
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, I never even thought of leaving any of the methods unimplemented. By implementing them all I had the ability to write unit tests to test my thread handling; leaving some of them unimplemented means I wouldn't have been able to test all possible scenarios.

Also, the additional methods are not difficult, especially if you make cunning use of helper methods.

Guess we'll see if it worked, I write my written exam tomorrow :/

J
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic