通过设计模式解决问题 [英] Solve a problem by Design Pattern

查看:87
本文介绍了通过设计模式解决问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我有一个发送短信的WindowsService。

此服务可以发送六种类型的消息。

例如可以在传感器温度升高时发送短信
传感器湿度增加


但是我的一个客户只需要温度,或者我的客户想要所有这些温度。

我想通过一个设计模式来解决它。

什么设计模式对我有好处?

请求帮助我。

解决方案

尝试装饰。 [ ^ ]



为每个客户添加(装饰)他需要/想要的功能

Hello
I have a WindowsService that sends sms .
This service can send six type of message .
For example can send sms when the temperature of a sensor is increased
of the humidity of a sensor is increased.
but one of my customer wants only temperature or one of the other my customer wants all of them .
I want to solve it by one Design Pattern .
What Design Pattern can be good for me ?
pleas help me.

解决方案

Try decorator.[^]

For each client add (decorate) only functionality that he needs / wants


这篇关于通过设计模式解决问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆