I'm a big fan of the visitor pattern for writing network clients and
servers.  You basically add an accept method to your message classes.  When
the IoHandler gets a messageReceived message, you can use a visitor to
handle it depending on the exact message type.

You can use the visitor pattern in a bunch of other places as well, such as
in your encoder to write more specialized encoders for each message type.

Good luck!

-Adam


On 9/7/07, Simon Aquilina <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Thanks for your reply :) I never read anyone of the books you have
> mentioned. So I believe I will take your suggestions and read
> Head-First-Design-Patterns first.
>
> I believe that your suggestion to experiment and ask questions is what I
> need to do. I wrote some small server applications, however I stopped
> short
> from completing them since I felt I was doing them wrongly. At the moment
> I
> am doing this research as a hobby, so I do not have deadlines to follow,
> something I feel it is playing in my disadvantage!
>
> Anyways, thanks again for the reply :)
>
> Regards,
> Simon J.
>
>
> >From: Rob Butler <[EMAIL PROTECTED]>
> >Reply-To: [email protected]
> >To: [email protected]
> >Subject: Re: MINA: Design Patterns
> >Date: Fri, 7 Sep 2007 07:10:11 -0700 (PDT)
> >
> >The official tome of design patterns by the Gang Of Four (GOF) is of
> course
> >required reading.  But it's a bit dry, and simply boring!
> >
> >
> http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612
> >
> >I really enjoyed Head First Design Patterns.  Much better read.  It
> covers
> >some of the patterns in GOF (not all) but does a better job of making it
> >readable and interesting. They cover some other patterns as well which
> are
> >useful.  If you've read neither start with this one first.  Not only will
> >you actually finish it because it's enjoyable, but it will better prepare
> >you for the dry GOF.
> >
> >http://www.amazon.com/Head-First-Design-Patterns/dp/0596007124
> >
> >The poster is nice too:
> >http://www.amazon.com/Head-First-Design-Patterns-Poster/dp/0596102143
> >
> >There are some other design patterns books, some even in Java.  I haven't
> >read any of them yet (plan to).  So there could be some good ones.
> >
> >A good basic understanding of design patterns will help you with all
> sorts
> >of software development, not just Mina.  Unfortunately, I don't know of
> any
> >books on SEDA (Staged Event-Driven Architecture) based design, which MINA
> >closely mirrors.
> >
> >The best way to learn, once you have a basic understanding from the
> books,
> >is to build applications and work/talk/exchange ideas with other
> >developers.  You will learn so much more from your peers than you could
> >ever get anywhere else.  Especially if you can interact with either
> senior
> >developers with lots of general experience, or in the case of Mina
> >developers with in-depth specific experience.  You've started down that
> >path already though by posting to this list.  ;)
> >
> >Looking at the source of well built open-source projects is also a great
> >way to learn too.  (Unfortunately, not all open source projects are well
> >built).  Mina's code would be a great example to learn from.
> >
> >Hope that helps some.
> >Rob
> >
> >----- Original Message ----
> >From: Simon Aquilina <[EMAIL PROTECTED]>
> >To: [email protected]
> >Sent: Friday, September 7, 2007 9:38:00 AM
> >Subject: MINA: Design Patterns
> >
> >Hi,
> >
> >First of all I am sorry if this is not strictly related with MINA
> >development. However I thought it was a good thing to ask this question
> to
> >people who I consider to be experts in the subject.
> >
> >Basically I have spent this last year reading about sockets, servers,
> >clients, etc. This last month I came across MINA and I started study the
> >examples. I feel I can build simple applications now, however I am far
> away
> >from the talent I have seen here.
> >
> >I was wondering if anyone here knows about any good books regarding
> Design
> >Patterns when building server / client applications that can help me
> >develop
> >better MINA applications and such applications in general as well.
> >
> >My concerns is when building server applications that need to handle
> >hundreds of clients at the same time, how to manage multiple connections
> >with the same clients (for example one to chat, one to talk, and for web
> >cam
> >and so on), and many other problems that at the moment (due to my limited
> >experience) I still can not for see.
> >
> >Again I am sorry if this thread may seem too much like an off-topic.
> >However
> >I would be very great full for anyone with a reply.
> >
> >Thanks and Regards,
> >Sim085
> >
> >_________________________________________________________________
> >FREE pop-up blocking with the new MSN Toolbar - get it now!
> >http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
> >
> >
> >
> >
> >
> >
> >
>
> >____________________________________________________________________________________
> >Looking for a deal? Find great prices on flights and hotels with Yahoo!
> >FareChase.
> >http://farechase.yahoo.com/
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>

Reply via email to