Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prefered approach to server mode?

 
Bj�rn Lilja
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have the "Bodgitt and Scarper" assignment. I have some concerns if the application must be a single application or if it can consist of a client (started with parameter local or network) and a separate server.

From the assignment instructions:


The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.

The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.


Especially the last section above indicates that the program should actually only be one (able to act as both server and client depending on the startup parameter) and not separated.

I would be truly greatful for some help and indications of how you guys have approached this issue.

Thanks,
Bj�rn
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In standalone mode it must be one; in networked mode you need two.

The trick most people apply is doing a structure like this:

UI
Adapter
Data server

Implement the Adapter in two classes, one which is just a simple pass-through and one which performs networking. You can then separate between UI and adapter for the networked mode. The UI and Data server classes need not "know" whether they are using standalone or networked mode.

Frans.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11911
207
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bj�rn,

Welcome to JavaRanch and this forum.

There should only be one executable jar file in your submission. So from that perspective, there is only one single application.

However the command line parameter (or lack of command line parameter) sets the mode of the single application. It can be working in one (and only one) of server mode, networked client mode, or standalone client mode.

Regards, Andrew
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andrew Monkhouse:
There should only be one executable jar file in your submission. So from that perspective, there is only one single application.


Ehm, that is indeed a much clearer answer than mine. Apologies if my answer seemed to suggest that multiple applications had to be delivered.

Frans.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic