File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about DesignPattern

 
HaoZhe Xu
Ranch Hand
Posts: 222
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing a SCJD project, my project is URLyBird, a room booking system
In the instruction, it said there're three main part:
Server database management system
Client GUI
Network connection between those two
and the program must be able to work in a non-network mode, but I'm not sure what does it mean because the instruction also told me that the data access class must be called "Data.java", must implement a interface, so I got confused:
Client ----------- | Network Connection | ---------------Server
| |
| |
| |
Data Data
(for non-networking)(for networking)
So the Data class only deal with file accessing(open and read file from harddisk), it does not involve anything about networking, am I right?
but the database management system is on the Server side, if it runs in non-networking mode, does it have a DBMS? Does the DBMS mean the Data class?
I am in trouble...
 
Ken Krebs
Ranch Hand
Posts: 451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HaoZhe,

So the Data class only deal with file accessing(open and read file from harddisk), it does not involve anything about networking, am I right?

Correct.
but the database management system is on the Server side, if it runs in non-networking mode, does it have a DBMS? Does the DBMS mean the Data class?

The DBMS is the Data code, the interface it implements, and all its helpers.
You can also put an adapter in front of Data's interface so the client does not work with it directly. This helps to keep server code independent of client code.
 
HaoZhe Xu
Ranch Hand
Posts: 222
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still a little confused: in non-Networked mode, do I need Server? For what?
 
Ken Krebs
Ranch Hand
Posts: 451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HaoZhe,
You need to have a clear separation of responsibilities within your code to make it maintainable and hopefully reusable as well.
 
joe black
Ranch Hand
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does the client interact with the server in non-networked mode?
 
Kerry Friesen
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Black:
How does the client interact with the server in non-networked mode?

It doesn't. Your client doesn't need to communicate with a server in non-networked mode. The server should only be there to facilitate the network connection for network mode.
Regards,
Kerry
 
joe black
Ranch Hand
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does it access the methods in the Data class when in non-networked mode?
 
Kerry Friesen
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Black:
How does it access the methods in the Data class when in non-networked mode?

Many people, including myself, created a data adapter that provides access to your data class. You could make two adapters, one for each connection type, that implement an interface that defines the actions performed by the client, such as findRooms and bookRoom. Of course, that's just a suggestion
Cheers,
Kerry
 
joe black
Ranch Hand
Posts: 103
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And when in the non-networked mode, should the user have to specify where the database file is, or is it safe to assume it's in the same directory?
 
Terry Martinson
Ranch Hand
Posts: 293
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe -
In my implementation I plan to let the user either type in the database location or locate it with a JFileChooser.
TJ
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic