• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default "data access class" vs Adapter

 
David Nemeskey
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am doing the URLyBird assignment right now. While designing the architecture, I found something, which confused me a little. The instructions state that

Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface:


Does this mean that I have to make the Data class public? I want to use an Adapter to hide locking (I plan to do it server-side), and probably to change the interface to an object-oriented one. That means I will have two public interfaces to the db... oh well.

And just another question: when they say you must implement everything where the instruction uses the word "must", they mean it literally, right? So if a sentence states that something "should" do something, I will not fail automatically, if I do not follow it to the letter?

Thanks,
David
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to "should" - I would say that you're not required to conform this requirement, but you should describe WHY didn't you implement this feature.
 
Rudolph Jen
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>Does this mean that I have to make the Data class public?

An Interface can only have public methods, so that your implementing class (in this case Data.java) must define these method as public as well. There is no choice in that.

You only could use an none-public constructor for your Data.java, so that not everybody can create an instance of that implementation. I am not that far, so that I am not sure, what I am going to use. I will see.

Hops that I understood your question right

Best Regards,
R
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic