Flags Over Objects
The Flags Over Objects anti-pattern occurs when behavior is written outside of an object by inspecting flags (such as status codes), rather than within the object itself.
This violates the Tell, Don’t Ask principle, and results in chatty interfaces and distribution of behavior that probably belongs within the object.
Working around this issue, one will often experience the Shotgun Surgery coding smell, in which many small changes to many files are required in order to make changes to the system.
There are many ways to address this anti-pattern.
In the worst cases, the State design pattern can effectively be used to bring all state-transition related behavior into the object, or at least into objects specifically constructed to handle the responsibility of state and state transitions.
Flags Over Objects的更多相关文章
- Makefile文件学习总结
Makefile文件相当于是一种脚本编程语言,目的是实现自动化编译.编写makefile文件的过程中可以使用变量.控制结构和函数等一般编程语言的特性. Makefile文件的组成内容.makefile ...
- Object Pascal中文手册 经典教程
Object Pascal 参考手册 (Ver 0.1)ezdelphi@hotmail.com OverviewOverview(概述)Using object pascal(使用 object p ...
- Tell Don’t Ask
The Tell, Don’t Ask (TDA) principle suggests that it is better to issue an object a command do perfo ...
- Other Linker Flags到底是什么
一.问题描述 在项目开发中用到百度地图,有时候在工程中会报“方法找不到”的错误(unrecognized selector sent to instance). 二.问题分析 首先,要说明一下Othe ...
- The Truth About .NET Objects And Sharing Them Between AppDomains
From http://geekswithblogs.net/akraus1/archive/2012/07/25/150301.aspx I have written already some ti ...
- Using self-defined Parcelable objects during an Android AIDL RPC / IPC call
Using self-defined Parcelable objects during an Android AIDL RPC / IPC call In my previous post “Usi ...
- 【转】关于Xcode的Other Linker Flags
链接器 首先,要说明一下Other Linker Flags到底是用来干嘛的.说白了,就是ld命令除了默认参数外的其他参数.ld命令实现的是链接器的工作,详细说明可以在终端man ld查看. 如果有人 ...
- 关于Xcode的Other Linker Flags
背景 在ios开发过程中,有时候会用到第三方的静态库(.a文件),然后导入后发现编译正常但运行时会出现selector not recognized的错误,从而导致app闪退.接着仔细阅读库文件的说明 ...
- 【Java】Objects 源码学习
2017-02-10 by 安静的下雪天 http://www.cnblogs.com/quiet-snowy-day/p/6387321.html 本篇概要 Objects 与 Object ...
随机推荐
- C# Newtonsoft.Json JObject移除属性,在序列化时忽略
原文 C# Newtonsoft.Json JObject移除属性,在序列化时忽略 一.针对 单个 对象移除属性,序列化时忽略处理 JObject实例的 Remove() 方法,可以在 指定序列化时移 ...
- Win8 Metro(C#)数字图像处理--2.42图像光照效果算法
原文:Win8 Metro(C#)数字图像处理--2.42图像光照效果算法 [函数名称] 图像光照效果 SunlightProcess(WriteableBitmap src,int X,in ...
- 芒果TV For Windows10 成长历史 & 迭代历史 & 新闻报道
芒果TV 是国内领先的基于Windows10操作系统并支持Windows10全系列设备的视频应用和内容服务商. Win10商店版<芒果TV>是湖南快乐阳光互动娱乐传媒有限公司专门为Wind ...
- Windows下配置Redis,并修改密码
原文:Windows下配置Redis,并修改密码 Windows下配置Redis,并修改密码 下载 Redis Windows版本的GitHub链接,直接下载zip文件解压到指定文件夹下或者下载msi ...
- C#读取数据库内容并转换成xml文件
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\bi ...
- Linux之文件的压缩与解压缩
压缩格式 .zip,.rar,.7z,.tar,.gz,.xz,.bz2,.tar.gz,.tar.xz,.tar.bz2,其中,形如*.tar.gz为tar打包,gz压缩的文件 zip压缩打包程序 ...
- DIY Delphi 半透明窗体(2)
写文章的时候 脑子有点乱 unit uMainForm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics ...
- Tencent://Message/协议的实现原理(Windows提供协议注册)
腾讯官方通过 Tencent://Message/协议可以让QQ用户显示QQ/TM的在线状态发布在互联网上:并且点击 XXX ,不用加好友也可以聊天 官方链接: http://is.qq.com/w ...
- HTTP请求GET和POST的区别
HTTP请求GET和POST的区别: 1.GET提交,请求的数据会附在URL之后(就是把数据放置在HTTP协议头<request-line>中), 以?分割URL和传输数据,多个参数用&a ...
- 你一定能看懂的JDK动态代理
前言:阅读这篇文章前,一定要知道什么是代理模式,具体可以参考这篇文章<设计模式(一):代理模式>. 在<设计模式(一):代理模式>一文中说了,程序员思思买书有两种选择:一种是选 ...