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 / October 2007

Tip: Looking for answers? Try searching our database.

Designing for protocol independence

Thread view: 
Karsten Wutzke - 04 Oct 2007 12:48 GMT
Hello!

I'm currently developing a chat client. I want to design the software
for protocol independence. It ought to be a very simple design, I
don't want to create a general purpose protocol (framework). The
protocol consists mainly of textual data to be put on and read from
the socket In/OutputStream's. For the client to use the software, it
should not be visible, whether the user's chat is running via server X
with protocol X or it runs on server Y using protocol Y. In any case,
the server (or IP range) is expected to know only one protocol.

Maybe there's a simple pattern for it? Maybe something more trivial
(simple subclassing)?

Can you share your experience how I might proceed?

Thanks
Karsten
Roedy Green - 04 Oct 2007 13:15 GMT
>I'm currently developing a chat client. I want to design the software
>for protocol independence.

You might have a look at how Sun does things like allow vendors to
plug in JCE implementations, or JDBC drivers.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Lasse Reichstein Nielsen - 04 Oct 2007 19:48 GMT
> Maybe there's a simple pattern for it? Maybe something more trivial
> (simple subclassing)?

Yep. Find the best division between the code that is protocol
independent and the code that implements the protocol. Make good
interfaces exposing only the logical operations you need (e.g.,
"send message") in a protocol agnostic way.

Then implement the interface once for each protocol you want
to use.

You'll then need some business logic to select the protocol when
you need it. That might be using the Strategy pattern.

/L
Signature

Lasse Reichstein Nielsen  -  lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
 'Faith without judgement merely degrades the spirit divine.'



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



©2008 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.