wood burning stoves*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Client-Server System Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Client-Server System" Watch "Client-Server System" New topic
Author

Client-Server System

Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
Hi,

I just fail to understand what a traditional client-server system is. So what do you do, if the client tells you it's a MUST to use this kind of system and runs away and plays hide and seek? Does this mean a 3-tier architecture is a NO GO? Does this mean I can't use the MVC-pattern?
Edit: In other words do I have to use a 2-tier architecture?

Thanks for your help
Bob

EDIT: I am working on URLyBird 1.1.3

Here is what the assignment says about the major components:
The main architecture of the application must be a traditional client-server system. There are three key parts: the server-side data management system, the client-side GUI, and the network connection between the two.


SCJP 6 - SCJD - SCWCD 5 - SCBCD 5
JavaEnterpriseEditionFaq - TomcatFaq
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Bob!

If I understood your concern, this idea of the system you have to build is simpler than you are thinking. You just have to build a system that consists of a server and a client, which implements the problems that you can find in your assignment. The application also must be able to run in standalone mode, which means that everything must run locally, and no server must be required. The way you are going to divide this functionality is up to you; for instance, you may want to build a fat client or a thin client. In my case, my server only offers database-related operations (and for this, I built another interface that looks pretty much like the one you received). The business logic of booking and searching is on the client side, and the client uses the operations of the server. You may still use MVC, as well as other patterns, certainly.

There's also a discussion about technical terms, which you can find here. This also might be helpful.

Please take a look and let us know if you still have doubts!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
Roberto Perillo wrote:...

There's also a discussion about technical terms, which you can find here. This also might be helpful.

Please take a look and let us know if you still have doubts!


Hi Bob,

thanks for your fast answer and yes that answered my question. Great thread btw.
I guess I just think to complicate, but I really don't like the MUSTS in the assignment, which are explained very vague (see also the quote).
Your posts has given me some more ideas for the assignment, which is good and bad. I just can't decide which way to go
I was just very confused by all this discussions about thin/fat client and 2-tier/3-tier all combined with the following requirement from my assignment:
server ... must provide locking functionality as specified in the interface provided above

If I understood your approach (and my understanding of fat and thin), you use a fat-client together with a 3-tier model.
What would be a 2-tier approach in this context including the logic on the client side? I mean, if you want to do it properly you separate the logic from the gui
and then you have a 3-tier (or layer) approach? You see I am confused.

Thanks for your help
Bob

Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Bob!

I guess I just think to complicate, but I really don't like the MUSTS in the assignment, which are explained very vague (see also the quote).


Well, one of the points of this certification is how to deal with this kind of situations (it does happen in real life).

Your posts has given me some more ideas for the assignment, which is good and bad. I just can't decide which way to go


Go with the good ideas!

So... if tier is physical, and layer is logical, then you should build a 2-tier system (client and server), and logically divide them the way you judge better. The point is, you have to make decisions and justify them. Don't don't give yourself a hard time: after you finish this, you'll feel that you are a better developer!

My approach was the same presented in the EJB 3 In Action book (that is, four-tier layered architecture). I keep the logic of lock/update/unlock in the business logic layer, in the bookRoom() method (which runs in the client side, that's why it is a thick/fat client). One good tip is to design your interface of the business logic layer and create implementations for it (local and remote), so that your GUI can consume these services. My approach was to use the thick client, so in the server side, I just have the server offering the functionalities of the database (through an interface whose implementation uses the Data class). If you decide to have a thin client, then you'll have business methods (such as bookRoom(), with the lock/update/unlock logic in it) on the server side.

So you have 2 physical tiers (client and server) and you can have 4 logical layers (GUI, business layer, persistence layer and database). This is a widely used architecture schema and helps keeping the concerns separate and promotes loosely coupled components.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2242
    
    7

Hello Bob.

Choosing 2 or 3 tier architecture just make your OO design more clear. For example, 3 tier would separate the DB, server and client into their own packages. However thinking from the physical layer approach... it is really a 2 tier or client/server application. Even the DB and server can be physically separated, meaning the DB file on the 3rd computer, the code can't be physically separated! Can you separate the source/classes into say 3 jars (1 each for client, db and server?) Probably not because somewhere the db package is needed so it's a client/server app. And if you do manage to 3 jars how you cater for the standalone... which includes the client and db packages?

So if you have to put in 3 jars... you can't. I did try this once and I eventually got:
1) client + db = standalone or network client
2) server + db = network server

Therefore, only 2 jars.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
Hi Bob, (did I already say i like your name? )

Roberto Perillo wrote:
So... if tier is physical, and layer is logical, then you should build a 2-tier system (client and server), and logically divide them the way you judge better. The point is, you have to make decisions and justify them. Don't don't give yourself a hard time: after you finish this, you'll feel that you are a better developer!

I think I go with this definition for tier (physical) and layer (logical). So a 2-tier system is what I will do. From the assignment I feel not really comfortable with
a thin client, so a fat client will it be. Next time I have to decide faster. I put too much effort in this (I even draw the UML for both ) Anyway, I learnt a lot.

Roberto Perillo wrote:
My approach was the same presented in the EJB 3 In Action book (that is, four-tier layered architecture). I keep the logic of lock/update/unlock in the business logic layer, in the bookRoom() method (which runs in the client side, that's why it is a thick/fat client). One good tip is to design your interface of the business logic layer and create implementations for it (local and remote), so that your GUI can consume these services.

You mean, you have your business methods like bookRoom() implemented twice in a RemoteService and LocalService?
Something like the code below? I followed an approach like Andrew Monckhouse in his book (two separate connector files for remote or local access).
But I think I like this approach more for my assignment.



Roberto Perillo wrote:
So you have 2 physical tiers (client and server) and you can have 4 logical layers (GUI, business layer, persistence layer and database). This is a widely used architecture schema and helps keeping the concerns separate and promotes loosely coupled components.

In all my concepts for this assignment I used the 4 logical layers approach and didn't know it.
Thanks for that and all.

cheers
Bob
Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
Hello K.,

K. Tsang wrote:
Choosing 2 or 3 tier architecture just make your OO design more clear. For example, 3 tier would separate the DB, server and client into their own packages. However thinking from the physical layer approach... it is really a 2 tier or client/server application. Even the DB and server can be physically separated, meaning the DB file on the 3rd computer, the code can't be physically separated! Can you separate the source/classes into say 3 jars (1 each for client, db and server?) Probably not because somewhere the db package is needed so it's a client/server app. And if you do manage to 3 jars how you cater for the standalone... which includes the client and db packages?


In other words, if someone talks about client/server applications (traditional or whatever), it's still possible to use a 3-tier architecture IF it is meant logically.

Thanks for that.
cheers
Bob

Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Bob (indeed, I like your name too :mrgreen!!!

Yes, the code you posted here seems to be in the right way. That's the idea.
Now, as my good buddy K said, you can have the database in a 3rd computer, so it would be client, server and database -> 3 tier architecture! But the how the code is divided logically is what we call layers (as you said). So you got the idea!
Vasya Pupkin
Ranch Hand

Joined: Dec 06, 2006
Posts: 39
Bob Wheeler, don't forget to call your unlock method in the finally block.


SCJP, SCJD
Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
Hi Vasya,

won't forget it. My example code was not the real one.

Thanks anyway.
cheers
Bob
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Client-Server System
 
Similar Threads
Local Adapter Issue
URLYBird1.3.3 must use 2 tier ?
NX: Exposing different interface to client (than the one provided)
client/server design - a must?
2 tier or 3 tier design