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# 自定义泛型类,并添加约束
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- SQL Server 阻止组件 xp_cmdshell
错误信息描述 消息 15281,级别 16,状态 1,过程 xp_cmdshell,第 1 行SQL Server 阻止了对组件 'xp_cmdshell' 的 过程 'sys.xp_cmdshell ...
- 用蓝牙连接debian和诺基亚手机
本方法已经用debian 4.0.诺基亚9300和一个hl-united牌子的USB蓝牙适配器测试过了,效果很好. 1.安装必要的软件包: #apt-get install ...
- excel操作for(lutai)
条件统计某个区域的值 第一种方法: =SUMIFS(P2:P5,L2:L5,A2) 第一个参数:被求和的单元格范围 第二个参数:明细表条件值单元格范围 第三个参数:主表条件单元格(可以是范围) 公式的 ...
- Windows 10开发基础——指针事件和操作事件(一)
主要内容: 1.指针事件 2.操作事件 1.指针事件 指针事件由各种活动输入源引发,包括触摸.触摸板.笔和鼠标(它们替代传统的鼠标事件).指针事件基于单一输入点(手指.笔尖.鼠标光标),但不支持基于速 ...
- golang1.8 通过plugin方式build so
golang1.83只有linux下支持plugin方式生成so package main // // No C code needed. import "C" import ( ...
- C#应用配置信息保存和读取
//保存信息 SystemConfig.WriteConfigData(“字段名称”, “这里是需要保存的内容”); //读取信息 SystemConfig.GetConfigData(“字段名称”, ...
- Advanced Installer读取注册表时将Program Files读取为Program Files (x86)的解决办法
原文:Advanced Installer读取注册表时将Program Files读取为Program Files (x86)的解决办法 今天同事在做安装包的时候,有一个读取注册表路径的需求,需要根据 ...
- 【Windows10 IoT开发系列】开发人员模式设置
原文:[Windows10 IoT开发系列]开发人员模式设置 声明:本文转自微软Windows 开发人员中心(https://msdn.microsoft.com/library/windows/ ...
- UWP项目生成安装包远程安装在树莓派上
原文: UWP项目生成安装包远程安装在树莓派上 哎,好纠结啊!如果这个名字写的太长,会显得太繁琐,如果写的短又好像说不清楚,我这语言表达水平实在是令人担忧啊!不过应该能够明白啥意思吧!因为对这个感兴趣 ...