Java中boolean干将"是" VS"是" [英] Java boolean getters "is" vs "are"

查看:298
本文介绍了Java中boolean干将"是" VS"是"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,在Java中约定布尔干将是包括preFIX是。

I know that the convention in Java for boolean getters is include the prefix "is".

isEnabled
isStoreOpen

但如果主语是复数?也就是说,如果不是想知道,如果商店是开放的,我想知道是否所有的商店都开什么?

But what if the subject is plural? That is, what if instead of wanting to know if a store is open, I wanted to know if all the stores are open?

isStoresOpen()不使英语语感。

我很想写这样干将:

areStoresOpen
areDogsCute
areCatsFuzzy

和我认为这是有意义的,但我已经被别人认为我应该只吸起来,放弃受主谓一致,并使用 isStoresOpen ,<$告诉C $ C> isDogsCute , isCatsFuzzy

And I think that would make sense, but I've been told by others that I should just suck it up and abandon subject verb agreement and use isStoresOpen, isDogsCute, isCatsFuzzy.

总之,我应该为它的复数主题进行操作布尔getter方法​​呢?

Anyway, what should I do for boolean getters which operate on a plural subject?

推荐答案

我不记得这是从书,但实质是code会被读了很多次,比它的写入。写可读性。

I can't remember which book this was from, but the essence is that code will be read many more times than it's written. Write for readability.

这篇关于Java中boolean干将&QUOT;是&QUOT; VS&QUOT;是&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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