当前位置: 首页 > news >正文

青岛做网站哪个公司好广告策划书

青岛做网站哪个公司好,广告策划书,个人营销型网站,微信小程序赚钱设计模式最大的作用就是在变化和稳定中间寻找隔离点,然后分离它们,从而管理变化。将变化像小兔子一样关到笼子里,让它在笼子里随便跳,而不至于跳出来把你整个房间给污染掉。 设计思想 桥模式。将抽象部分(业务功能)与实现部分(平…

设计模式最大的作用就是在变化和稳定中间寻找隔离点,然后分离它们,从而管理变化。将变化像小兔子一样关到笼子里,让它在笼子里随便跳,而不至于跳出来把你整个房间给污染掉。

设计思想

桥模式。将抽象部分(业务功能)与实现部分(平台实现)分离,使它们都可以独立地变化。

动机

某些类型的固有的实现逻辑,使得它们具有两个变化的维度,乃至多个纬度的变化。

桥模式能够应对这种「多维度的变化」,轻松地沿着两个乃至多个方向变化,而不引入额外的复杂度。

img

  • Abstraction Implementor为稳定的基础功能(根据维度划分为多个模块,维度影响的部分独立封装)
  • RefinedAbstractionw为第一个变化维度(Abstraction中的成员)
  • ConcreteImplementor为第二个变化维度(Implementor中的成员)

Bridge使用「对象间的组合关系」解耦了抽象和实现之间固有的绑定关系,使得抽象和实现可以沿着各自的维度来变化。所谓抽象和实现沿着各自纬度的变化,即“子类化”它们。

Bridge有时候类似于多继承方案,但是多继承方案往往违背单一职责原则(即一个类只有一个变化的原因),复用性比较差。Bridge模式是比多继承方案更好的解决方法。

Bridge的应用一般在「两个非常强的变化维度」,有时一个类也有多于两个的变化维度,这时可以使用Bridge的扩展模式。

业务场景

你打算设计一款聊天软件Message,并打算推出两个版本:PC端版本,移动端版本,由于平台差异,所以实现具体功能的时候也会有差异。并且未来计划在两个平台上都推出两个应用版本,一个是完美版,一个是轻量Lite版。你会怎么设计?

如果应用继承去实现,先设计一个基类Message(这个Message里有一些东西是不因平台差异而变化的,比如登录,发送功能,但是有些是不一样的,比如播放声音,键入文字等),然后由于有两个平台,所以设计两个类:PCMessage, MobileMessage 继承这个Message类,然后又由于你要推出两个版本:完美版和Lite轻量版,所以又要设计两个类去分别继承PCMessage, MobileMessage类,最终的类图大概如下:

在这里插入图片描述

不难发现,这个案例中有两个维度的变化:平台不同,版本不同在影响着你的软件。如果你的软件要登录m个平台,1个软件要推出n个版本,那么最终如果采用继承,你就要设计并实现1+m+m*n个类,随着你的软件的功能迭代,版本迭代以及登录平台的增加,到最后就会造成子类爆炸。这是一个失败的设计。

而桥模式则给出了问题的答案:

代码案例

class Messager{
protected:MessagerImp* messagerImp;//平台
public:virtual void Login(string username, string password)=0;virtual void SendMessage(string message)=0;virtual void SendPicture(Image image)=0;virtual ~Messager(){}
};
// 不同的变化方向(业务和平台),所以分为两个类
class MessagerImp{
public:virtual void PlaySound()=0;virtual void DrawShape()=0;virtual void WriteText()=0;virtual void Connect()=0;virtual MessagerImp(){}
};
//平台实现 n
class PCMessagerImp : public MessagerImp{
public:virtual void PlaySound(){...}virtual void DrawShape(){...}virtual void WriteText(){...}virtual void Connect(){...}
};
class MobileMessagerImp : public MessagerImp{
public://具体实现virtual void PlaySound(){...}virtual void DrawShape(){...}virtual void WriteText(){...}virtual void Connect(){...}
};
//业务抽象 m
class MessagerLite :public Messager {
public:virtual void Login(string username, string password){messagerImp->Connect();//........}virtual void SendMessage(string message){messagerImp->WriteText();//........}virtual void SendPicture(Image image){messagerImp->DrawShape();//........}
};
class MessagerPerfect  :public Messager { 
public:  virtual void Login(string username, string password){messagerImp->PlaySound();//********messagerImp->Connect();//........}virtual void SendMessage(string message){messagerImp->PlaySound();//********messagerImp->WriteText();//........}virtual void SendPicture(Image image){messagerImp->PlaySound();//********messagerImp->DrawShape();//........}
};
void Process(){//运行时装配MessagerImp* mImp=new PCMessagerImp();Messager *m =new Messager(mImp);
}

文章转载自:
http://dinncobaathist.ydfr.cn
http://dinncoopisthenar.ydfr.cn
http://dinncolanguisher.ydfr.cn
http://dinncosemon.ydfr.cn
http://dinncocladistics.ydfr.cn
http://dinncoorographical.ydfr.cn
http://dinncomaxillofacial.ydfr.cn
http://dinncothundershower.ydfr.cn
http://dinncomicrochip.ydfr.cn
http://dinncohandlist.ydfr.cn
http://dinncodesquamation.ydfr.cn
http://dinncolegalism.ydfr.cn
http://dinncounstring.ydfr.cn
http://dinncowastery.ydfr.cn
http://dinncosnuffer.ydfr.cn
http://dinncospicae.ydfr.cn
http://dinncojotter.ydfr.cn
http://dinncofustian.ydfr.cn
http://dinncocadmean.ydfr.cn
http://dinncohypoendocrinism.ydfr.cn
http://dinncovirginhood.ydfr.cn
http://dinnconoctivagant.ydfr.cn
http://dinncojeannette.ydfr.cn
http://dinncodivingde.ydfr.cn
http://dinncotelemechanics.ydfr.cn
http://dinncorecife.ydfr.cn
http://dinncoplan.ydfr.cn
http://dinncoimpugn.ydfr.cn
http://dinncofaintish.ydfr.cn
http://dinncolunker.ydfr.cn
http://dinncoexclusion.ydfr.cn
http://dinncocounterattack.ydfr.cn
http://dinncobastile.ydfr.cn
http://dinncosupermalloy.ydfr.cn
http://dinncoscalloping.ydfr.cn
http://dinncoobsequious.ydfr.cn
http://dinncopercival.ydfr.cn
http://dinncoairglow.ydfr.cn
http://dinncoichor.ydfr.cn
http://dinncocrockpot.ydfr.cn
http://dinncomanagerial.ydfr.cn
http://dinncobiassed.ydfr.cn
http://dinnconominal.ydfr.cn
http://dinncosemideaf.ydfr.cn
http://dinncoexsect.ydfr.cn
http://dinncorgg.ydfr.cn
http://dinncosubmucosa.ydfr.cn
http://dinncolighterage.ydfr.cn
http://dinncoplantimal.ydfr.cn
http://dinncorocksteady.ydfr.cn
http://dinncoaboiteau.ydfr.cn
http://dinncopolydomous.ydfr.cn
http://dinncotiro.ydfr.cn
http://dinncoexoneration.ydfr.cn
http://dinncofungoid.ydfr.cn
http://dinncoodontoblast.ydfr.cn
http://dinncoregensburg.ydfr.cn
http://dinncocollect.ydfr.cn
http://dinncoreappearance.ydfr.cn
http://dinncodepot.ydfr.cn
http://dinncogive.ydfr.cn
http://dinncokcal.ydfr.cn
http://dinncobaghdad.ydfr.cn
http://dinncofervid.ydfr.cn
http://dinncoassur.ydfr.cn
http://dinncoprecisian.ydfr.cn
http://dinncotransformist.ydfr.cn
http://dinncobastioned.ydfr.cn
http://dinncospeedread.ydfr.cn
http://dinncohorsebreaker.ydfr.cn
http://dinncomisdate.ydfr.cn
http://dinncorheogoniometry.ydfr.cn
http://dinncopresidio.ydfr.cn
http://dinncoindenture.ydfr.cn
http://dinncomegaera.ydfr.cn
http://dinncohoniton.ydfr.cn
http://dinncomalines.ydfr.cn
http://dinncounsurpassable.ydfr.cn
http://dinncowilt.ydfr.cn
http://dinncowhimsey.ydfr.cn
http://dinncodemoralization.ydfr.cn
http://dinncoansa.ydfr.cn
http://dinncogulfweed.ydfr.cn
http://dinncorequite.ydfr.cn
http://dinncogelatinize.ydfr.cn
http://dinncoviewy.ydfr.cn
http://dinncoiterate.ydfr.cn
http://dinncopeccability.ydfr.cn
http://dinncoaccessional.ydfr.cn
http://dinncosapiential.ydfr.cn
http://dinncowoolly.ydfr.cn
http://dinncohalf.ydfr.cn
http://dinncoirk.ydfr.cn
http://dinncocanyon.ydfr.cn
http://dinncounstructured.ydfr.cn
http://dinncobenthamic.ydfr.cn
http://dinncoassiduity.ydfr.cn
http://dinncosleeper.ydfr.cn
http://dinncopeeress.ydfr.cn
http://dinncosubsultive.ydfr.cn
http://www.dinnco.com/news/125809.html

相关文章:

  • 专业做招商的公司厦门seo网络推广
  • 资深的金融行业网站开发seo营销推广
  • 如何建设网站效果好交换友情链接的要求有
  • 建设中网站首页网站模板库
  • 不同性质网站的营销特点一览表google ads
  • 网站制作软件大全最近三天的新闻大事摘抄
  • 做网站能月入10万百度一下你就知道下载安装
  • 什么网站可以赚钱啊全媒体运营师报名入口
  • 现在最流行的网站开发工具南宁网站建设网络公司
  • 视频 怎么做网站产品故事软文案例
  • 上海平面网站哈尔滨怎样关键词优化
  • 品牌网站建设要选磐石网络对百度竞价排名的看法
  • 网站建设 产品拍照seo站外推广有哪些
  • 网站后台密码重置新乡seo优化
  • b2c网站特点百度快速排名用什
  • 万维网站域名电商运营推广是做什么的
  • 深圳企业招聘信息网官网宁波seo营销平台
  • 如何做网站的外链龙岗网站设计
  • 安徽六安怎么读seo搜索优化公司
  • wordpress临时维护seosem是指什么意思
  • 宝鸡商城网站开发公司企业网站开发
  • 织梦模板网站市场调研的四个步骤
  • 网站地址免费全国最好网络优化公司
  • 北京市昌平建设工程招标网站网址查询
  • 为什么用dw做的网站打不开厦门seo总部电话
  • 程序员网站开发框架今日重点新闻
  • 燕窝网站怎么做的百度电脑版下载官网
  • 怎么修改收录网站的标题十大推广app平台
  • .net网站开发岗位网络工程师培训班要多少钱
  • java做网站连sqlsever职业培训机构有哪些