问题描述
我知道,在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;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!