2010-07-06 85 views
0

Id喜欢使用一些设计模式的信使。 Messenger的功能有:信使的设计模式

  1. *服务器上的登录用户
  2. *负载朋友到联系人列表
  3. *接收/发送邮件
  4. *注销用户

我在设计模式初学者,所以我需要一些建议。哪种模式适合这种情况?

我想到代理模式。

回答

2

对于初学者来说,这是一项相当重要的任务。我建议看看WCF(Windows Communication Foundation)并查看发布/订阅模式。它基本上是观察者模式。

我将完成此任务的方式是将所有客户端(用户)订阅(登录)到主要服务,以检索朋友事件(登录,注销,好友请求等)。服务器也可以是希望彼此交谈的客户之间的握手。

当客户端实际发起聊天时,每个客户端都可以公开他们自己的pub/sub服务。然后,每个客户端可以相互订阅,从而为彼此提供实时事件触发,而不必通过服务器进行中继。

这只是一个建议,因为有很多方法可以做到这一点。希望这会让你指向正确的方向。但WCF是最好的方式去恕我直言。在这个解决方案中使用

模式:

  • 发布/订阅(观察者)
  • 辛格尔顿
  • 代理
  • .NET提供模式(单,工厂和策略的组合)。
+0

OK,我知道WCF ...我需要的模式的名字..谢谢ü非常 – Tom159 2010-07-06 22:35:45

0

设计原则和面向对象的设计模式

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

设计模式和企业Java

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

构建业务层 建模实体和使用案例

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

减小碰撞已知的性能瓶颈

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

定位对象

* Singleton 
* Factory 
* Inversion of Control 
* Service Locator 

实现与会话Bean

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

与信息服务

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

人通信的业务逻辑老龄化资源的集成层 抽象的数据层

* 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服务

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

处理事务的有效

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

构建表示层 分离控制和表示逻辑

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

规划和实施复杂的工作流程

* Front Controller 
* Dispatcher View 
* Service to Worker 

本地化不同的逻辑

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