使用"是"命名布尔变量是不好的做法? [英] Is using "is" to name Boolean variables bad practice?

查看:120
本文介绍了使用"是"命名布尔变量是不好的做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时的命名以是不好的做法,现在就开始布尔?我的经理认为,isAnything是过时的和贫穷的做法。这是真的吗?

  myManager.isLame?正确的是():不正确的();


解决方案

它用于经常在很多的语言,但我不知道它是否可以肯定地说,它是preferred方法。

我觉得一致性,每个人都使用相同的标准给定的球队/风格是要记住最重要的事情。

Is naming Booleans that start with "is" bad practice now? My manager believes that "isAnything" is outdated and poor practice. Is this true?

myManager.isLame ? correct() : incorrect();

解决方案

It's used quite often in a lot of languages, but I don't know if it can be said with certainty that it's the preferred method.

I think consistency and everyone on a given team using the same standards/styles is the important thing to bear in mind.

这篇关于使用"是"命名布尔变量是不好的做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆