1998年属什么生肖| 胆囊息肉有什么症状| 还行吧是什么意思| 死海是什么| mr什么意思| 辅警政审主要审些什么| 阴道为什么会排气| 克霉唑为什么4天一次| 精满自溢是什么意思| 做梦代表什么生肖| 水逆什么意思| 秦始皇原名叫什么| 羯羊是什么羊| 中医湿气重是什么意思| 米字五行属什么| 胆囊炎吃什么消炎药| 挂号是什么意思| ost什么意思| 天加一笔变成什么字| 四十年婚姻是什么婚| 维生素b5药店叫什么| 鸭子吃什么食物| 三堂会审是什么意思| 什么叫肽| 万圣节是什么时候| 手上长疣是什么原因造成的| 膝盖积水是什么原因造成的| 光明会到底是干什么的| 抽血化验挂什么科| police是什么品牌| 聚聚什么意思| 端午节喝什么酒| 一般手脚慢进什么工厂| 高血脂会引起什么疾病| 哥文花园女装什么档次| 新生儿黄疸高有什么风险| 霍建华为什么娶林心如| 分家是什么意思| 打嗝不停是什么原因| 听之任之是什么意思| 原则性问题是什么意思| 腺瘤型息肉是什么意思| 耳膜破了有什么症状| 鱼油有什么作用| 女生纹身什么图案好看| 1987年属什么| 入党有什么用| 异卵双胞胎什么意思| 预调酒是什么意思| 1985年出生是什么命| 出汗太多吃什么药好| 养膘是什么意思| 水代表什么| 爱出油的人身体缺什么| 凤尾是什么菜| 后背凉是什么原因| 覆水难收什么意思| 辛味是什么味| 什么时候闰三月| 来月经肚子疼是什么原因| 油嘴滑舌是什么意思| 数据中心是什么| 金融行业五行属什么| 玫瑰花像什么| coolmax是什么面料| 60年是什么婚| 产品批号什么意思| 03年属什么| 单核细胞偏低是什么意思| 黄精为什么要九蒸九晒| leysen是什么牌子| 蒂芙尼蓝是什么颜色| 隐翅虫咬人后用什么药| 子宫内膜增生是什么原因| 中国国酒是什么酒| 肺部条索影是什么意思| 输卵管为什么会堵塞原因是什么| 吃头孢为什么不能喝酒| 64年属什么| 视力s和c代表什么| dr检查是什么| 肠脂膜炎是什么病严重吗| 评头论足什么意思| 腌鱼放什么调料| 男孩取什么名字好听又有贵气| 肾结石有什么症状| 紫五行属什么| 罗纹布是什么面料| 女性膀胱炎吃什么药| 白发越来越多是什么原因造成的| 绝经三年了突然又出血了什么原因| 大姨妈来了两天就没了什么原因| polo villae是什么档次| 痘痘里面挤出来的白色东西是什么| 见龙在田什么意思| 什么东西补铁效果好而且最快| pv是什么意思| 滋养是什么意思| 妇科活检是什么意思| 结扎挂什么科| 吃什么降血糖| 芽菜是什么菜| 马桶对着卫生间门有什么不好| 劳动局全称叫什么| 盗汗吃什么药| 梦见栽树是什么预兆| 四字五行属什么| 12月16是什么星座| 胸口正中间疼痛是什么病症| 盗汗吃什么药效果最快| 改善记忆力吃什么药好| 一九六三年属什么生肖| 梦见和老公吵架是什么意思| 梦见被鱼咬是什么意思| 肉桂茶适合什么人喝| 服务是什么意思| 举重的器材叫什么| 什么是树莓| ac疫苗是预防什么的| 痔疮用什么药膏| 一直拉肚子是什么原因| 什么植物和动物最像鸡| 梦见自己的车丢了是什么意思| grace是什么意思| 尿液浑浊是什么原因| 检查贫血挂什么科| 糖尿病喝什么茶| 无语是什么意思| 吃莲子有什么好处| 宝宝支气管炎吃什么药| 为什么头顶会痛| 铺天盖地的意思是什么| 血小板是什么意思| 秋高气爽是什么意思| 形婚是什么| 香蕉什么时候吃最好| s代表什么| pio是什么意思| 这句话是什么意思| 乳糖不耐受是什么意思| 申时五行属什么| 金火什么字| 金字旁加者念什么| 从未是什么意思| 脑瘤是什么原因引起的| 耳朵里痒是什么原因| 半青皮是什么意思| 什么是自锁| 五月什么星座| 恩怨是什么意思| 喝啤酒吃什么菜最好| 平胸是什么原因导致的怎样解决| 口水分泌过多是什么原因| 有点尿就想尿什么原因导致的| 为什么养鱼养单不养双| 手指腱鞘炎是什么原因造成的| 黑绿色大便是什么原因| 囊胚是什么意思| 内项和外项是什么| 吃什么祛痰化痰最有效| 中国国鸟是什么鸟| 情人节送什么| 茵陈有什么功效| 血塞通治什么病最好| 冒虚汗是什么原因| 湉字五行属什么| 肛裂是什么原因造成的| 联通查话费打什么号码| 雄性激素过高是什么原因| 花肠是母猪的什么部位| 脾胃虚弱吃什么中药| 广东菜心是什么菜| 提单是什么| 为什么一吃饭就胃疼| 臣附议是什么意思| 疣有什么危害| 1984年属什么生肖| 头部出汗多是什么原因| ch表示什么意思| 黄加黑变成什么颜色| 送长辈什么礼物合适| 五花肉炒什么好吃| 怎么知道自己五行缺什么| 非经期少量出血是什么原因| 吃饭后胃胀是什么原因| 太阳像什么的比喻句| 边界尚清是什么意思| 舌头尖疼吃什么药| 胆囊结石挂什么科| 干冰是什么| davena手表什么牌子| 男属鸡的和什么属相最配| 男人射的快是什么原因| 凤是什么意思| 宠辱不惊是什么意思| 孩子说话晚是什么原因是什么情况| 什么减肥产品最好| 百香果和什么不能一起吃| 隐形眼镜什么牌子好| 松子是什么树的果实| 肾虚是什么症状| 心电图st段改变什么意思| 凭什么| 男性阴囊瘙痒是什么病| 祖马龙香水什么档次| 外阴瘙痒用什么药膏好| 紫癜是什么意思| 用进废退是什么意思| 1014是什么星座| 愚痴是什么意思| 导管扩张是什么意思| 乌龙茶是什么茶| 玉树临风什么意思| degaia是什么牌子| 怪力乱神是什么意思| 为什么舌头老是有灼烧感| 歆字取名什么寓意| 李嘉诚戴的什么手表| 世界上最大的蛇是什么蛇| 茄子吃了有什么好处| 1955属什么生肖| 睑腺炎是什么原因造成| 百香果和什么搭配好喝| 亭亭净植是什么意思| 哺乳期吃辣椒对宝宝有什么影响| 低密度脂蛋白偏高是什么原因| 痢疾是什么意思| 文理分科什么时候开始| 古埃及是什么人种| 覆水难收什么意思| 安眠药有什么副作用| grader是什么意思| 3楼五行属什么| 姓杨的女孩子取什么名字| 何乐而不为是什么意思| 起夜是什么意思| 性有什么好处和坏处| 胃胀是什么症状| 什么水果不上火| 旅长是什么军衔| 被蜈蚣咬了用什么药| joseph是什么意思| 视网膜为什么会脱落| 右眼皮跳是什么预兆女| 斑秃去医院挂什么科| 支气管发炎用什么药| 额头冒痘是什么原因| 大红袍适合什么季节喝| 胃疼应该吃什么药| 针清是什么| 视线模糊是什么原因| 马蹄什么季节上市| 什么叫辟谷减肥法| 2月11日什么星座| 肝脏彩超能检查出什么| 头晕吃什么| 什么是岩茶| 三福是什么| f4是什么意思| 桑蚕丝是什么面料| 牛子是什么| 舌苔厚腻吃什么药| 云彩像什么| 武警是干什么的| 百度
BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Articles Implementing Automated Governance for Coding Standards

黑色上衣配什么颜色的裤子

百度 游戏硬件发展到了今天,微软率先发出了一个信号。

This item in japanese

Most development organizations of a significant size have some form of coding standards and best practices. For many organizations, simply documenting these standards and keeping them up to date can be a significant challenge. Beyond that, the consistent enforcement of such standards and best practices can be even more difficult. Our organization has found that enforcing coding standards and best practices in an automated fashion through our build process has been highly effective.

The proactive nature of our solution is the most important aspect. Even in mature organizations where code reviews are performed and direct feedback is given to individual employees about bad coding practices, if this process happens retroactively then the stakes are raised; the mistake has already been made and the developer is on the defense. Even worse, if the review does not happen during the development process, then the bad code has already reached production and the damage has been done. Because our build process is centrally controlled and a compliance check is executed automatically during the build of any software asset, harmful code never gets promoted in the first place, reducing the need for costly cleanup projects and uncomfortable employee performance discussions that result from more retroactive audit strategies. Instead, developers are given immediate feedback (an HTML report in our case) by an emotionless system that doesn't care if they made a mistake. So the developers still have an opportunity to learn from their mistakes, and the system will continue to proactively ensure that the organization is protected from dangerous code even if it takes the developer a couple of build attempts to remember a new coding standard.

A centralized build process

In order for the strategy we will discuss here to be effective, two things need to happen:

  1. There needs to be a server based, centralized build process. Ours happens to be a build system based on Ant scripts that we developed in house because we built it before products like AntHill and Maven had matured. If you were starting today I would recommend you select a third party build management system rather than build your own. The fact that we built our own did make some of the process customizations I will talk about more straightforward, but you should be able to integrate the same functionality into many third party build systems.
  2. You need to make sure that going through the build system is the only way that development teams can promote code into the test and production server environments. I don't like to be dogmatic about things, but this part is not optional. If developers can just FTP java class files directly into one of the environments and bypass the build process then the effectiveness of the solution we are discussing here will be dramatically reduced. We protected our environment from this scenario by simply locking down write access to the relevant directories on our servers and only giving write authority to an account that runs the JVM process that hosts our build system, thereby making our build process the only mechanism developers have to get code into our production and test environments. Because our build system pulls the selected project directly from our source control repository every time it executes a build, this lockdown accomplishes two things for us: it ensures that all code in test or production is also in source control, and it also ensures that all code in those environments has gone through an automated software audit.

Tooling the automated software audit

We happen to use a product called Parasoft Jtest for our automated code audits, but there are other products that can accomplish what we will talk about here. Jtest has some pros and some cons. Overall it has been an effective tool for us, but we had to hack an infrastructure around it to get it to work the way we needed it to; it was definitely not an out-of-the-box solution for the strategy presented here. Jtest has two main features: static analysis and dynamic analysis. The dynamic analysis features of Jtest are useful, but we won't talk about them here because it is out of the scope of this strategy.

We purchased Jtest about 4 years ago when our organization was having problems with unclosed database connections in production due to resources not being cleaned up property in a try/catch/finally block. Sound familiar to anyone? This was before Rod Johnson descended from the heavens and delivered the JdbcTemplate, and many organizations were struggling with this issue. This kind of coding issue is exactly the kind of thing that Jtest is great at preventing. It analyzes the structure and content of a Java class and applies rules to it. A rule in this context would be something like: if a database connection is created or obtained from the connection pool within a method body, make sure that there is a try/catch/finally block and that the connection is closed or returned to the pool in the finally block. To make a long story short, 4 years ago we created a Jtest rule that did exactly that, made it a "Severity 1" error, and (this part is important) changed our build system to automatically halt any builds that had Severity 1 Jtest errors. The system worked great, and the database connection issues went away.

Now that we have Rod and the JdbcTemplate, this particular rule is less relevant, but is still useful for our legacy Java apps that haven't converted to Spring. And there are now many more rules that we check for which are still relevant. We have found it to be a great tool for enforcing architectural standards. For example, when our organization implemented a logging standard, we turned on a rule that made it impossible to promote System.out.println statements, which were no longer permitted. And these examples just scratch the surface. There are a few hundred rules that come out of the box with Jtest, and you can create your own as you need to.

Some caveats about Jtest: as I stated earlier, Jtest as a server wasn't good to go when we got it. Parasoft's main product line is an Eclipse plug-in which does the static and dynamic analysis from within a developer's IDE. That is not what I am talking about. I am talking about a server based Jtest product that is integrated into our server infrastructure via command line calls from our build server. Parasoft feels that the kind of definitive organizational control and governance we are discussing here can be achieved by buying the IDE plug-in for all of your developers and hooking them up to Parasoft's centralized reporting server, but we have not found that to be the case. The problem is that Parasoft can't guarantee that a developer ran a static analysis before checking source code into CVS. Because they have no control over the eclipse CVS plug-in (or Subversion or whatever), there is no control point where Jtest can say "Stop! You can't do that if you have severity 1 errors!" Because of this, the test has to be run not on the desktop but instead at a central control point, and for us, that is our central build system. So we needed a server version of Jtest that could be called from the build system during every build, and we had to do that integration work ourselves (although it wasn't terribly difficult).

I also want to re-iterate that Jtest isn't the only game in town. Adrian Colyer and others have talked about using AspectJ aspects to enforce coding standards. That could be very easily implemented on a centralized build server. I am not sure if you could do everything with aspects that you can do with Jtest, but it's free. Other competitive products and eclipse plug-ins perform a varying subset of the static analysis functionality found in Jtest. And if you want to start out really light, eclipse has support for stylistic and syntactical coding standards within the standard JDT.

Best Practices for Governance Rollout

Your strategy for rolling out automated software governance is far more important than the technologies you choose to build your solution. Here are some of the lessons that we have learned after doing this for a few years:

  1. Keep the governance structure simple. We only have 3 categories of rules: Severity 1, 2, and 3. Severity 1 rules will stop your build, and your project will not be able to get into our test and production environments until that issue is fixed. Severity 2 is basically a staging area. It tells the developer that this rule will be a severity 1 within the next 6-12 months, so they should probably fix it now before they find themselves under a deadline and unable to build their code. Severity 3 doesn't have teeth. It's something we recommend that you fix, but until we promote it to a 2 it doesn't have the potential to actually stop a developer from being productive.
  2. Be conservative. As I stated earlier, Jtest comes with hundreds of rules out of the box. When we first deployed Jtest we had only 2 severity 1 rules turned on. The reason for this was simple: we wanted to avoid establishing a precedent for bypassing the control point because a project manager is screaming about a rushed deadline. It is better to be conservative and have the process be authoritative than to be aggressive and have the exceptions pile up.
  3. Do proactive impact analysis. When you are about to deploy new Severity 1 rules, you should have a pretty good idea of the frequency with which they occur in your projects and the time and cost of remediating that code. This is not hard – you just need to run a static analysis over those projects with the new rule activated and take a look at what the report looks like. This will save you from deploying a new Severity 1 rule that can't be sustained by the organization, forcing you to demote it back to a Severity 2. If the impact analysis is too high, keep it a Severity 2 for another development cycle. If you don't see a reduction in number of the occurrences, work on your message to the organization regarding the importance of addressing Severity 2 issues. There will be times when a critical issue forces you to implement a Severity 1 rule that has a broad impact, but when you do so it is absolutes critical that management understands the impact and supports the decision.
  4. Communicate well. Talk to your community about the new rules, the value behind them, and the reasoning that went into implementing the new rules. Most of the time the development community with agree with you, but they don't like to be surprised.

The details of our implementation notwithstanding, proactive and automated software audits have been a great benefit for us. The quality of our production software assets has increased, but perhaps more importantly we have accomplished this using a reliable system that we could count on organizationally without focusing a lot of energy on maintaining it. Maintaining human based organizational processes to support standards require focus and energy from organizational leadership. By designing your development support infrastructure appropriately you actually get more organizational security with less effort expenditure.

About the Author

Mark Figley leads the architecture group at AIG United Guaranty, the Mortgage Insurance arm of AIG, the world's largest insurance company with $800B in assets.

Rate this Article

Adoption
Style

BT
煮馄饨放什么调料 乳房胀痛是什么原因引起的 和可以组什么词 你算什么男人歌词 火烧是什么
扁桃体肥大吃什么药好得快 喝什么利尿效果最好 什么鲜花填动词 巨大的什么 甲功七项能查出什么病
相见不如怀念是什么意思 男人纹身纹什么运气好 天然是什么意思 七月一号是什么星座 AG是什么
wh是什么颜色 望尘莫及的及是什么意思 什么生肖不能养龟 为什么冬吃萝卜夏吃姜 gpd是什么意思
碱水对人有什么危害hcv7jop9ns0r.cn 六块钱的麻辣烫是什么意思hcv8jop5ns7r.cn 盆腔炎吃什么药好hcv9jop1ns2r.cn 俄罗斯特工组织叫什么hcv9jop1ns8r.cn 高血压不能吃什么水果adwl56.com
紫色适合什么肤色的人hcv8jop9ns7r.cn 胰腺炎恢复期吃什么好hcv8jop3ns2r.cn 属猪男配什么属相最好hcv8jop6ns6r.cn 钰字五行属什么hcv8jop3ns0r.cn 健康四大基石是什么hcv9jop1ns6r.cn
梦里梦到蛇有什么预兆hcv9jop4ns6r.cn 肚子绞痛吃什么药hcv9jop4ns5r.cn 回声欠均匀是什么意思hcv8jop8ns4r.cn 老人喝什么牛奶比较好clwhiglsz.com 小孩腿抽筋是什么原因引起的chuanglingweilai.com
vivian是什么意思hcv8jop7ns5r.cn 小狗感冒症状是什么样的hcv7jop9ns9r.cn 青海湖里面有什么鱼hcv9jop6ns3r.cn 今年54岁属什么生肖hcv8jop9ns5r.cn 拍花子是什么意思hcv8jop8ns5r.cn
百度