Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

Pattern/s sought for chat client implementation

Thread view: 
Karsten Wutzke - 14 Aug 2007 13:44 GMT
Hello!

I'm developing a chat client and I'm looking for the right pattern for
the object/s that handle the messages between the client and server.
The users can participate in several chats at once. You can think of
it as an IRC client basically, much like ICQ, MSN, AIM or such, just
with many people in a chat (chatroom).

I'm currently looking at the Proxy pattern. Don't know if I might need
a Facade pattern, Chain of Responsibility pattern doesn't seem to
apply, but I'm not sure if I'm on the right track here.

That object being responsible will likely need to dispatch the
incoming messages to the respective chat windows.

Can anyone give some assistance please?

Since the client is implemented in Java what other classes/packages
might be important to mention?

TIA
Karsten
Daniel Pitts - 14 Aug 2007 20:41 GMT
> Hello!
>
[quoted text clipped - 18 lines]
> TIA
> Karsten

Generally, you don't start out looking for patterns to implement, you
think about how you want to implement it, and the see which patterns
that implementation is like.

If all your chat client/servers are always going to be java, you might
consider RMI.

If you want to define your own wire protocol, then you should instead
define that protocol first, and implement an API that lets you send
and receive messages.

Something as simple as a chat client/server shouldn't be over
thought.

Basically, you might have something like:

A shared library: Contains necessary code to send and recieve messages
A client: Presents the messages and actions to a user
A server: Recieves a messages, processes them, and sends them back out
to the clients.
Karsten Wutzke - 15 Aug 2007 12:16 GMT
> > Hello!
>
[quoted text clipped - 39 lines]
> A server: Recieves a messages, processes them, and sends them back out
> to the clients.

The chat app is not Java only. The server component can basically be
anything, as well as the protocol to use. I want to design for that.
So RMI seems out of the question.

It looks like proxy is the right thing here, facade maybe, chain of
responsibilty not really.

I now wonder about the proxy stuff Java has to offer (new thread).

Karsten
Bjorn Borud - 23 Aug 2007 12:48 GMT
[Karsten Wutzke <kwutzke@web.de>]
| It looks like proxy is the right thing here, facade maybe, chain of
| responsibilty not really.

I've designed and implemented several chat servers, chat clients and
similar message-oriented systems, and I can't say that it makes any
sense to start off with the sort of patterns you want to use -- I am
not even sure where in the design you want to use them.

-Bjørn
Bjorn Borud - 23 Aug 2007 12:45 GMT
[Karsten Wutzke <kwutzke@web.de>]
| Hello!
|
| I'm developing a chat client and I'm looking for the right pattern for
| the object/s that handle the messages between the client and server.

start by modeling the data flow.

-Bjørn
Ishwor Gurung - 23 Aug 2007 17:35 GMT
> [Karsten Wutzke <kwutzke@web.de>]
> | Hello!
[quoted text clipped - 5 lines]
>
> -Bjørn

If the OP hasn't got his/her head around it, the communication goes this
way:
1) Server listens for incomming connection on certain address on a certain
port.
2) Client connects to server on the address on that particular server's
port.
3) Client requests some data from the server
4) Server handles the request, processes it, sends it off to the client.
5) Client handles the data, processes it and presents it to the user
interface.

This is the most simple schematic view of the whole application as it can
get (intracacies has been left out for clarity and conciseness).

If by pattern, you mean Gamma et. al ones, you could read up on composite,
singleton and especially observer/client patterns.

HTH

Signature

Cheers,
Ishwor Gurung
/* humpty dumpty */



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.