• 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

May I add additional methodes in data.java?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
My first thought after reading the specs is that I should avoid adding additional public members to my data class. I thought that Sun may exchange the data.java through a self written one in order to test whether the server only relies on the DBMain interface.
But now I not shure anymore about that. What do you think about that? Is Sun doing such things at all?
Thanks for all responses.

Cheers
Stef
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Best way to make sure is to look in your assignment. Is there a section called "How The Assignment is Marked"? If so, read that and then see what the answer is.
 
Stef Widmer
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Robert,
Is this the sentence "software checks that overall structure and nomenclature conform to specification". This I don't understand totaly. Perhaps it's my english...
Well, it doesn't give me an aswer to my question "Can I add additionaly public members to data.java". Can you reply one again?
Thanks for your answer.
Stef
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stef,

If you want to add methods to the Data class and the only requirement you have been given is that you 'must' implement a certain interface you wouldn't be breaking this rule. Obviously document your decision.

If you are adding public methods that other classes may access then you could add a second interface to spell out the contract that the implemented class will follow.

BUT.... What exactly do you plan to add? If you want to add private helper methods that help the read, find, update etc. methods to work then no problem.

If, on the other hand, you are adding something that has other classes dependent on it then beware!. A simple test of switching of the Data class (as you mentioned) could fail.



The "software checks structure and nomenclature" means that your submitted .jar file will be checked to see that all requirements are met. That you have a Data class and a design decisions documents etc..

Steven
 
Stef Widmer
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much for your answer.
The reason I'd like to add more methode is that in my design the data.java implements the DBMain interface but also extends File. This way it's easy to open the db file like this "raf = new RandomAccessFile(this, "rw");".
And I need for example a public close() methode which closes the Database file. Does I have a general design flaw here?
Thanks for more hints...

Cheers
Stef
 
Robert Konigsberg
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steven, maybe it's just my assignment, but it seems to be that the DB interface, for instance, does not provide any mechanism for opening the resource. So of course, you need an open(String) method. Of course your Data class might be able to get around it, but that just seems poor.

Just my $.02.

Rob
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it is alright to add additional methods in the Data class. If you take a look at the methods of the DBAccess interface, there are methods that are redundant and there are some functions that your program needs but are not specified by the interface. The specification does not say anything like you must not create new methods in the Data class. I had four additional methods that I feel is neccessary to meet the must requirements at my user interface section.

I implemented all the methods in the DBAccess method but only use the unlock and lockRecord method in a class I call DataManipulator that provide access to the Data class. I believe that if you feel that there is a need for additional methods, you can just add it in, and be sure that you justify why you do that. I think that is how the General Considerations points come from.

I hope my humble opinion helps. Anyone who had passed SCJD can help in this topic? Thanks.
 
Climb the rope! CLIMB THE ROPE! You too tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic