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

Client in local mode

 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, maybe I'm not seeing the forrest for the trees, but I'm having trouble visualizing how a client is going to run in local mode unless there is a server in the same VM. If that's the case then will the client start the local server? That seems like an ugly design choice. But I can't see any other way other than accessing the db directly which is even uglier.
Thanks in advance
Michael Morris
SCJP
 
Adam Roberts
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm dealing with similar design problems myself
Here's how I'm hoping to approach it
The server components(the RMI and such) are not touched when the local mode is used. When the user chooses local mode, he recieves a different client class that acts similarly to the server side component that accesses the DB. In effect, the client and server are combined when this occurs.
Thats my current plan Not sure if its any good, but I'm open for suggestions.
Hope that helps a little
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Adam,
I was planning on using a Factory to send back an interface of DatabaseAccess or RemoteDatabaseAccess depending on the context. But assuming that means there is a server out there somewhere that serves the Factory to clients. Like I said earlier, maybe I'm missing the forrest for the trees or just missing something obvious. Either way I need some insight from someone who has passed the exam.
Thanks for the reply,
Michael Morris
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this is something you've already thought of and discarded but what if your client creates and instance of the Factory? In that case the client can also be its own server - if you want to think of it that way.
I don't think you need a separate server application in local mode - just a connection to the Factory which will hand you the proper database connection.
Burk
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Burk,
What about just keeping the Factory on the client side only? I haven't even considered that, but it seems plausible and cleaner than having a Factory on both ends. What do you think?
Any opinion is greatly appreciated.
Michael Morris
 
Adam Roberts
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my plan also
Good luck ;p
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Adam,
Yea, unless some guru advises me otherwise, that's the way I'm headed too.

Good luck
Michael Morris
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am posting to the first post in this thread.
And pardon the caps.

There is NO SERVER IN LOCAL MODE. local mode means it has all the data classes and db.db file already on the client machine and it uses that directly, no calls to RMI no Connection Factory, No Server.
Mark
 
xiaoma wang
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Mark:
In the local mode, I need to consider the multi-threads issues?
Regards
Xiaoma Wang
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the local mode, I need to consider the multi-threads issues?

Unless you plan on making your one local version to make multiple threads. Which to me is overkill, since local mode means only one user to one database. Why would they need to have many threads? There is no locking here either, no one else to lock out.
Mark
 
xiaoma wang
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark!
 
Cathy Young
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Spritzler:

Unless you plan on making your one local version to make multiple threads. Which to me is overkill, since local mode means only one user to one database. Why would they need to have many threads? There is no locking here either, no one else to lock out.
Mark

Mark,
Can I say that in local mode, there is nothing more than a GUI and a file access (to simulate some db operation)?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cathy - Yep basically. But still keep OOP in mind in decoupling the data from the GUI, which means you will find that except for the Server stuff, you want Local to almost match the Server Data Access side. Meaning you will still have some sort of interface to use to access the Data class which accessed the db.db file. and you might even have a Facade in front of that.
Mark
 
Cathy Young
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is very helpful clarification. Thanks, Mark!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic