This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Patterns for communication applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Patterns for communication applications" Watch "Patterns for communication applications" New topic
Author

Patterns for communication applications

mik kenstr�m
Greenhorn

Joined: Apr 22, 2005
Posts: 4
Hello,

I'm starting to study design patterns throughout using books like
Head First Design Patterns and Applied Java Patterns.

I'm especially interested in communications software and what kind of patterns that kind of software use. JMS and Web Services have their own mechanics how yo use them but how about RMI and Socket based applications?

Does anyone of you know that what patters should be used e.g. making
a RMI or Socket based server? If using sockets should I also make e.g. messageclasses to be used in server and client side etc. If using GUI maybe
communication should be started from GUI with Command pattern ...

Where should I start? Any conrete samples or documentation available?

I remembered that in year 95 - 97 there was a design patters book considering this kind of issues and samples were build with C++.

Any hints how to start?

Cheers

Mikke
Gerald Davis
Ranch Hand

Joined: May 15, 2002
Posts: 872
Services like RMI are already an implementation of a pattern; it�s an interface that hides distribution code from a specific implementation, if my memory serves me well. When I was doing my Java Developers Certificate I made the mistake of creating an interface on top of RMI to hide RMI implementation away from the client.

An interface on top of an interface often happens with bad OOP design. Many developers often try to hide SQL specific code by creating an interface. But SQL is already a pretty fine interface already; you don�t want to duplicate in the OOP code what the SQL server alread does because the interface become the bottleneck that only caters for the lowest common denominator.

If you want to do GUI using MVC, maybe there are already frameworks that already implement the pattern, and only require you to use metadata to create the GUI widgets.
mik kenstr�m
Greenhorn

Joined: Apr 22, 2005
Posts: 4
Okey, maybe RMI is not a good example but how about own text based protocol
which uses TCPIP carrying messages?

I'm thinking hard that how to build a design pattern based solution for this kind of software. 90's there where quite many C/C++ based frameworks like
these.

Now it's difficult find such using Google especially those made with Java.

So, if anyone have any references I would be very grateful to have them.

Cheers,

Mikke
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by mik kenstr�m:
I'm thinking hard that how to build a design pattern based solution for this kind of software.


What are you trying to gain from basing the solution on design patterns?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Gerald Davis:
Many developers often try to hide SQL specific code by creating an interface. But SQL is already a pretty fine interface already; you don�t want to duplicate in the OOP code what the SQL server alread does because the interface become the bottleneck that only caters for the lowest common denominator.


My experience is quite different: for anything but the simplest system, the needed SQL differs enough between different vendors that abstracting away from it pays back manifold.

It also allows you to use other persistence mechanism than RDBMS' - which can be quite interesting for systems that are supposed to live longer than a couple of years and might be used in environments you couldn't anticipate from the beginning.


If you want to do GUI using MVC, maybe there are already frameworks that already implement the pattern, and only require you to use metadata to create the GUI widgets.


https://binding.dev.java.net/ seems to be quite usefull.
Gerald Davis
Ranch Hand

Joined: May 15, 2002
Posts: 872
I should have known better myself; I guess that I cannot argue with you then. I wonder if there is a small layer of code abstraction for each vender that would standardise SQL.

Originally posted by Ilja Preuss:

SQL differs enough between different vendors that abstracting away from it pays back manifold.


I am sure what precisely what you mean
mik kenstr�m
Greenhorn

Joined: Apr 22, 2005
Posts: 4
quote riginally posted by mik kenstr�m:
I'm thinking hard that how to build a design pattern based solution for this kind of software.



quote:What are you trying to gain from basing the solution on design patterns?
A lot. OOP based language gives a more elegant and better way to maintain
your Framework or what ever your are building.

Why do you ask this? I thing it's quite clear fact you too. But don't want
to talk about it more.

Maybe it's easier way to get source code for e.g. one of Jakarta's projects
and see what patterns they use in different places and how.

Prost!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by mik kenstr�m:
OOP based language gives a more elegant and better way to maintain
your Framework or what ever your are building.


Ah, yes - OOP is a powerful tool. OOP != Design Patterns, though.


Why do you ask this?


Because you can have a good OO design without thinking much about patterns, and concentrating too much on patterns actually can lead to an overcomplicated design.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Messaging patterns there are. (Hmmm, looking forward to the next Star Wars movie I am.) My little Messaging Patterns page has some thoughts I used to organize some issues at work, and a link to Enterprise Integration Patterns which is much more rigorous and complete.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Patterns for communication applications
 
Similar Threads
Advice needed before switching towards Java domain by an experienced PHP programmer
Using Socket
localhost communication
Passed SCJD with 152/155
Log file parser