views:

60

answers:

2

Hi, Id like use some design patterns for messenger. Messenger functions are :

  1. *Login user on server
  2. *Load friends into contact list
  3. *Receive / Send messages
  4. *Logout user

I am beginner in design patterns, so I need some advice. Which of patterns is adequate for this situation?

I think about Proxy pattern.

+2  A: 

That's quite an undertaking for a beginner. I would recommend looking into WCF (Windows Communication Foundation) and look into the Publish / Subscribe pattern. Its basically the Observer Pattern.

The way I would accomplish this task would be to subscribe(logon) all clients (Users) to the Main Service, to retrieve Friend events (logon, logoff, friend requests, etc.). The server can also be the handshake between clients who wish to talk to one another.

When clients actually initiate a chat, each client can expose a pub/sub service of their own. Then each client can subscribe to each other, thus providing real time events firing to each other, rather than having to relay through the server.

This is only one suggestion, as there are many ways to accomplish this. Hopefully this will point you in the right direction. But WCF is the best way to go IMHO.

Patterns used in this solution:

  • Pub/Sub (Observer)
  • Singleton
  • Proxy
  • .Net Provider Pattern (combination of singleton, factory and strategy).
CkH
OK, I know WCF... I need names of patterns.. thank u very much
Tom159
A: 

Design principles and OO design patterns

* Leveraging OO design patterns which adhere to best practices
* Determining the appropriate design patterns for requirements
* Singleton
* Strategy
* Template
* Proxy
* Observer

Design patterns and Enterprise Java

* Analyzing goals of Enterprise Java applications
* Planning for distributed applications
* Communicating between JVMs
* Implementing Remote Method Invocation

Building the Business Tier Modeling entities and use cases

* Realizing an application's domain model
* Business Object
* Application Service

Reducing the impact of known performance bottlenecks

* Eliminating inter-tier dependencies
* Service Facade
* Session Facade
* Business Delegate

Locating objects

* Singleton
* Factory
* Inversion of Control
* Service Locator

Implementing the business logic with Session Beans

* Injecting services to business logic using Session Beans
* Conversing with client using Stateful Session Beans

Communicating with message services

* Decoupling client interaction with the Java Message Service (JMS)
* Simplifying JMS
* Transmitting and receiving messages with JMS
* Message-driven beans

Managing Resources in the Integration Tier Abstracting the data layer

* Implementing effective Data Access Objects (DAO)
* Highlighting difficulties associated with Object/Relational Mapping
* Analyzing persistence technologies: Hibernate, JPA, EJB 3.0
* Optimizing data transfer using the Transfer Object Pattern

Web Services

* Exposing Beans as Web Services with annotations
* Web Service Broker pattern

Handling transactions effectively

* Considering local and global transaction needs
* Selecting optimistic or pessimistic locking

Structuring the Presentation Tier Separating control and presentation logic

* Realizing the role of JSPs and servlets
* Constructing Model View Control (MVC) architectures

Planning and implementing complex workflows

* Front Controller
* Dispatcher View
* Service to Worker

Localizing disparate logic

* Improving maintainability of algorithms
* Writing modular JSPs
* Intercepting Filter
* View Helper
* Composite View