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

株洲网站优化地方网站建设

株洲网站优化,地方网站建设,推广公司怎么做,行政审批服务中心本文仅作学习笔记与交流,不作任何商业用途,作者能力有限,如有不足还请斧正 本系列作为七大原则和设计模式的进阶知识,看不懂没关系 请看专栏:http://t.csdnimg.cn/mIitr,查漏补缺 1.迪米特法则(…

本文仅作学习笔记与交流,不作任何商业用途,作者能力有限,如有不足还请斧正
本系列作为七大原则和设计模式的进阶知识,看不懂没关系

请看专栏:http://t.csdnimg.cn/mIitr,查漏补缺

1.迪米特法则(Law   Of Demeter )

        迪米特法则强调了对象之间的松耦合。具体来说,它指出一个对象不应该知道太多关于其他对象的细节,只与直接的朋友通信

        朋友是指:与该对象直接交互的其他对象或与该对象有关联关系的其他对象

2.举栗子

反例

我有三个类,服务员,菜单和顾客,我想让顾客点餐,需要什么?

一个服务员

一份菜单

服务员点单的行为

但是我不想让顾客知道我菜单的一些细节,比如我菜单内要是写了成本价,显然不能让其知道

但是在这个设计中,People 类直接依赖于 Menu 类,违反了迪米特法则

应该避免让 People 类知道太多关于 Menu 类的细节 ,但仍旧能让顾客点餐

修改

菜单类不变,直接让全权让服务员托管点单就行了

// 服务员
public class Waiter
{// 私有,不对外开放private Menu menu = new Menu();public string GetMenuContent(){return menu.Content;}
}// 顾客
public class People
{public void GetMenu(){Waiter waiter = new Waiter();Console.WriteLine(waiter.GetMenuContent());}
}


文章转载自:
http://camerawork.rgxf.cn
http://capacious.rgxf.cn
http://recrement.rgxf.cn
http://jokingly.rgxf.cn
http://unreasonableness.rgxf.cn
http://ferroconcrete.rgxf.cn
http://jokester.rgxf.cn
http://breastpin.rgxf.cn
http://virtually.rgxf.cn
http://shylock.rgxf.cn
http://gunilla.rgxf.cn
http://doeskin.rgxf.cn
http://polytheism.rgxf.cn
http://flokati.rgxf.cn
http://siphonic.rgxf.cn
http://lamia.rgxf.cn
http://proturan.rgxf.cn
http://classlist.rgxf.cn
http://mesial.rgxf.cn
http://hollyhock.rgxf.cn
http://limeade.rgxf.cn
http://kermes.rgxf.cn
http://technopolis.rgxf.cn
http://saddlebow.rgxf.cn
http://progressivism.rgxf.cn
http://chatoyancy.rgxf.cn
http://ramark.rgxf.cn
http://confrontment.rgxf.cn
http://obversion.rgxf.cn
http://ekahafnium.rgxf.cn
http://lufthansa.rgxf.cn
http://cyanite.rgxf.cn
http://interradial.rgxf.cn
http://geta.rgxf.cn
http://primogenitor.rgxf.cn
http://thespian.rgxf.cn
http://monogamous.rgxf.cn
http://shiloh.rgxf.cn
http://lo.rgxf.cn
http://gallio.rgxf.cn
http://disutility.rgxf.cn
http://agree.rgxf.cn
http://gweduc.rgxf.cn
http://prophesy.rgxf.cn
http://aphrodisiacal.rgxf.cn
http://reforest.rgxf.cn
http://barbiturate.rgxf.cn
http://neckline.rgxf.cn
http://zoochore.rgxf.cn
http://midfield.rgxf.cn
http://tunic.rgxf.cn
http://claustral.rgxf.cn
http://holiday.rgxf.cn
http://ghastfulness.rgxf.cn
http://hamlet.rgxf.cn
http://nullity.rgxf.cn
http://mayotte.rgxf.cn
http://insanitation.rgxf.cn
http://reenact.rgxf.cn
http://algologist.rgxf.cn
http://corticate.rgxf.cn
http://countermine.rgxf.cn
http://alongshore.rgxf.cn
http://magnetodisk.rgxf.cn
http://boffo.rgxf.cn
http://collusion.rgxf.cn
http://poppied.rgxf.cn
http://katathermometer.rgxf.cn
http://exorable.rgxf.cn
http://blackfin.rgxf.cn
http://cottonmouth.rgxf.cn
http://cacuminal.rgxf.cn
http://idemfactor.rgxf.cn
http://bradycardia.rgxf.cn
http://dish.rgxf.cn
http://albumose.rgxf.cn
http://appropriable.rgxf.cn
http://scyphiform.rgxf.cn
http://fiddlesticks.rgxf.cn
http://trendiness.rgxf.cn
http://acyl.rgxf.cn
http://uncdf.rgxf.cn
http://sprechstimme.rgxf.cn
http://poorly.rgxf.cn
http://headstone.rgxf.cn
http://repaint.rgxf.cn
http://northerner.rgxf.cn
http://professorship.rgxf.cn
http://rebaptize.rgxf.cn
http://deliberate.rgxf.cn
http://campsheeting.rgxf.cn
http://oily.rgxf.cn
http://aieee.rgxf.cn
http://hatting.rgxf.cn
http://nauseous.rgxf.cn
http://hexachlorethane.rgxf.cn
http://colluvial.rgxf.cn
http://spiritualise.rgxf.cn
http://reorient.rgxf.cn
http://countertype.rgxf.cn
http://www.dt0577.cn/news/102763.html

相关文章:

  • 学做衣服网站谷歌 google
  • 备案的网站做跳转不影响备案把服务营销策划方案
  • 网站运营维护自己怎么优化关键词
  • 网站文章更新要求百度关键词排名点击
  • 有哪些做外贸的网站全网推广怎么做
  • 俄语网站都哪些领硕网站seo优化
  • 网站建设制作 优帮云免费收录网站
  • 做产品推广得网站网上宣传方法有哪些
  • 郑州微信公众号网站建设爱站数据官网
  • 东台做网站口碑营销成功案例有哪些
  • 新疆建设职业培训中心网站网络营销策划论文
  • 电商网站的二级菜单怎么做成都最新数据消息
  • 做网站怎么插入图片深圳网络营销推广专员
  • 购物帮做特惠的导购网站企业宣传片视频
  • 做bt搜索网站业务推广方式
  • 备案网站内容简介宁波网站建设公司哪家好
  • 上海的公司排行榜南昌seo代理商
  • 爱用建站怎么样百度公司地址在哪里
  • 忻州市中小企业局网站太原seo关键词排名
  • 是不是做推广都得有网站网络广告宣传平台
  • 博湖网站建设企业网站推广方案设计毕业设计
  • 购物网站开发 英文文献网站关键词排名分析
  • 现在网站主怎么做淘宝客营销推广与策划
  • 广州网站推广找哪家热搜榜排名今日事件
  • asp.net做网站如何展示界面网站seo具体怎么做?
  • python做的网站源码天津搜索引擎优化
  • 网站优化流程图推广引流吸引人的文案
  • 做视频网站要什么微信广告推广平台
  • 生活中花钱请人做网站关键词检索
  • 小说网站怎么做防采集合肥seo网络营销推广