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 ...
随机推荐
- ABP框架——单表实体流程
实体实体配置文件菜单本地化语言:xml文件权限配置领域服务应用层CRUDDTOSPA路由:app.js视图生成:.html,.js
- Sequence Models and Long-Short Term Memory Networks
LSTM’s in Pytorch Example: An LSTM for Part-of-Speech Tagging Exercise: Augmenting the LSTM part-of- ...
- Linux杂谈: 树形显示多级目录--tree
最近写博客的时候偶尔会需要将文件目录结构直观地列出来,例如python的包结构. 于是在网上搜了搜,发现了一个Linux下还不错的工具--tree tree 可以很直观地显示多级目录结构. 1. 安装 ...
- ARTS 12.31 - 1.4
Algorithm 这是一道需要用动态规划的问题.求字符串的最长回文子序列. 复习了一遍动态规划,重点是要分析出最优解所包含的子问题的最优解,把过程描述为数学公式. 题目https://leetcod ...
- 使用Advanced Installer 13.1打包发布 Windows Service服务程序
原文: 使用Advanced Installer 13.1打包发布 Windows Service服务程序 项目中需要用到一个定时推送案件状态的需求,本人小菜一只,在同事建议下要写成一个windows ...
- File handling in Delphi Object Pascal(处理record类型)
With new users purchasing Delphi every single day, it’s not uncommon for me to meet users that are n ...
- 青云QingCloud宣布完成C轮融资,金额1亿美元
本轮融资由两家人民币基金领投,蓝驰创投跟投. 企业级基础云服务商青云QingCloud正式宣布完成金额为1亿美元的C轮融资,本轮融资由两家人民币基金领投,蓝驰创投跟投. 青云QingCloud公司成立 ...
- Window Features(包括Z-Order,Layered Windows, Message-Only Windows, Owned Windows, Window的状态等)
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632599(v=vs.85).aspx#owned_windows https: ...
- SYN591-A型 计数器
SYN591-A型 计数器 秒表计数器累计计数器电机测速表使用说明视频链接: http://www.syn029.com/h-pd-248-0_310_44_-1.html 请将此链接复制到浏览 ...
- 死磕 java同步系列之CyclicBarrier源码解析——有图有真相
问题 (1)CyclicBarrier是什么? (2)CyclicBarrier具有什么特性? (3)CyclicBarrier与CountDownLatch的对比? 简介 CyclicBarrier ...