Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

clarify this pls

 
Kruger Scheitz
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[B]" Writing Data Client. This implementation should include a class that implements the same public methods as the Data class "[\B]
what does this mean? pls help
 
Mag Hoehme
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kruger,
I have the same statement in my requirements, and I am also wondering about what I am supposed to do.
My design has a GUI, a remote DataAccess.class, and a DataAccess.class with a reference to Data. DataAccess has the same public interface as Data, plus business methods such as loadAll(), book().

I feel that it is enough if DataAccess has the same public interface as Data. Tucking something like DataClient between my GUI and DataAccess seems to be an unnecessary level of indirection.
However, maybe I create an interface called DataClient. This interface is implemented by DataAccess.
Any comments on this question are welcome!
 
Nate Johnson
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I did...
Local:
GUI -> ConnectionFactory -> LocalData (that extends Data)
Remote:
GUI -> ConnectionFactory -> RemoteDataFactory (on server) -> RemoteData (extends UnicastRemoteObject) and has ref to the one Data created by the RemoteServer
My ConnectionFactory returns a DataAccess interface (either RemoteData or LocalData as shown) above. This is determined based on the command line options that the client is given. My GUI also has a Facade (pattern) class that does things like booking and searching so that other developers can just call those methods rather than deal with the logic that is inside the methods.
Hope that helps
[ August 29, 2002: Message edited by: Nate Johnson ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What the statement means is that you need to create an interface that has all the public methods of the Data class, you will then create two classes that implement this interface. One for Remote Access and one for Local Access.
You can then make a Facade class that wraps around a DataAccess interface and only provides methods for the GUI that make sense, like bookFlight() or getAllAirlines() or searchFlight().
But including the Facade is up to you. I highly recommend this solution though.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic