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

NX: Data.java - method implementation

 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently working on my scjd (Bodgitt & Scarper) and was curious if anyone had any insight as to how far you should go with the method implementations in the Data class. Sun says you must implement DBMain (the provided interface) which includes create, delete, update, etc. But do you even have to implement any code for these actual functions if the user won't be using them via the gui anyway? I know that we are supposed to make our app extensible so things can be added in the future, but why should we have to actually implement delete and create if we arent even giving the user the abililty to create and update records?? And if you do actually write code to create and delete how does the examiner test this, since they can't test it via the gui?? Does anyone know if they actually write test cases for themselves to test? Or do they just look at your code and then make sure the gui works with it?? If anyone has any ideas that would be great, Thanks in advance!
Dave
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dave,
Welcome to JavaRanch.
You have to implement these methods in order to implement the interface. There is no way around that.
But I believe some people here are implementing them such that they just throw a "NotImplementedException". Perhaps someone who is doing that could post a comment as to why they believe it is acceptable?
Personally I think that Sun have described the desired functionality well enough that we should implement the methods so that they do what Sun want them to do, even if our clients don't use the methods.
Sun have a comment in the instructions stating that they have automated tests for the assignment. The only place these tests could be run is on the implemented interface, so I think it would be wise to make sure we do meet the instruction requirements.
Regards, Andrew
 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yah, you have to supply an implementation of each method in order to pass, but that means you could just leave the method body empty or just return a null/0 value in order to make the compiler happy. I just find it weird that they want us to implement something that isnt even going to be tested or used.
I agree that actually writing some functionality for these methods is the way to go, so i guess we are expected to test this on our own with some sort of dummy class that we write up on our own.
The only reason i question is because the theme when first approaching your assignment is to 'only do what sun tells you to do' nothing more and nothing less. So i would think that i could justify not providing anything in these methods, while still sticking to sun's instructions.
I'll probably end up actually provide the functionality for these methods, but i thought i would just check and see if its completely necessary.
Thanks,
Dave
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only reason i question is because the theme when first approaching your assignment is to 'only do what sun tells you to do' nothing more and nothing less.
But the comments describing what the methods do seem to be part of what Sun is telling us to do.
So i would think that i could justify not providing anything in these methods, while still sticking to sun's instructions.
I think most people here would disagree with this notion (I do at least), but as Andrew said, perhaps there are others who'd like to speak up in favor of this idea.
 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yah, I'm getting the feeling that you should just cover your ass so sun doesnt find some loop hole in their instructions and then fail you Thanks for your replies everyone! I'm just gonna implement em and test em to make sure they work.
Thanks again,
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic