2010-07-06 33 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