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

Data class on Client side

 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was able to use the same FBNData for both local/remote client cases. since I use a connection factory, I did not have to reimplement the FBNData on the client side.
Basically, my DataAccessFacade can use a connection object for the remote case and the FBNData for the local case.
However, the assigment states that on the client side, we should use the same public methods from suncertify.db.Data. I am not finding this necessary. Am I on the right track?
Thanks much,
Aruna.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What it really menas is that you should prgram to an interface, that interface being the public methods of the Data class. When you prgram to an interface, your class can then accept any type of class that implements that interface, like a Local or a Remote DataAccess class.
So even if your client uses a Facade, the Facade will have an instance of the class that implements the interface.
In my submission I have DataAccess interface which has all the public methods of Data class, then I have two class that implement the interface. DataAccessRemote and DataAccessLocal, so whichever mode my DataAccessFactory returns, the Facade can accept it and run with it. The client never has a clue which mode it is in. It is happy because it can access a Facade that can Access my two modes.
Mark
 
Adam Till
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark
There is a line in my assignment that slightly concerns me:-
'This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration.'
The bit that worries me is that the classes that implement the interface with the public methods from Data dont need the variables to create the remote access as this is done in a DataFactory class. Should I worry about this or is it as you said more about having and using interfaces?
Much obliged
 
Bernhard Woditschka
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The bit that worries me is that the classes that implement the interface with the public methods from Data dont need the variables to create the remote access as this is done in a DataFactory class. Should I worry about this or is it as you said more about having and using interfaces?

That's the cool thing the connection parameters - i.e. the filename or the url to naming - is passed into the Constructors which don't inherit.
You most probably don't want the user of your database server to create new files on the server anyway.
Bern
 
Adam Till
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration.'

Essentialy what I am asking is do I HAVE to have a class that implements the public methods of Data and have constructors for networks or not. If I dont will I fail???
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe I can clarify by example.
I had a DataInterface with two implementations --- the supplied Data class itself, and a server-side class which I'll call Connection.
My client-side class implementing the public Data methods was the rmic-generated stub class for Connection. This stub will certainly have different constructors, although I don't have the faintest what they look like; it's not important anyway. The instructions don't dictate anything for these constructors. They don't even say that you have to be the one writing the class (rmic "writes" it, in my case). The instructions just require that the class is there, and suggests that it would be constructed differently from the Data class, both of which are satisfied by the rmic-generated Connection stub.
As far as I can judge no points whatsoever were deducted because of this approach.
Does that help?
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic