1
cgpiao Feb 14, 2020
somethingIsDoing
|
2
GavinFlying Feb 14, 2020
def moving?(xxx), do: xxx
|
3
GavinFlying Feb 14, 2020 func IsMoving(xxx) { xxx }
|
4
icylogic Feb 14, 2020 via iPhone
if car.is_moving:
用 property 不就行了……外部又不关心你这是个函数还是值…… |
5
coderluan Feb 14, 2020
楼主你起名法不是不好,而是错误,翻译一下就知道了:“检查是否运行状态”,明显的语法问题,正常的应该是”检查是否运行“和”检查运行状态“,至于用哪个,个人习惯是看有没有对象:xx.isMoving()和 checkMovingStatus(xx)。
|
6
yamedie Feb 14, 2020
function checkIfMoving() {
// ... } |
7
raysonx Feb 14, 2020 via iPad
moving 或 isMoving
|
8
laoyur Feb 14, 2020 楼主的不太好,
如果是返回 Bool,那直接用 is_开头; 如果是返回 status,就不要带 moving,moving 本来就属于 status 的具体一种 case ; def check_status: return 'moving' def is_moving: return True |
9
lemon6 Feb 14, 2020
const isMoving
|
10
pomelotea2009 Feb 14, 2020 via Android
java 就 isMoving,python 就 is_moving
|
11
liufish Feb 14, 2020
isMoving
movingForward movingBack movingLeft movingRight |
12
bitdepth Feb 14, 2020 via iPad
motion, forward, toward 這麼多詞都可以
|
13
xiri Feb 14, 2020 via Android
一般判断是否怎么样我都是 is_xxx
|
14
imycc Feb 14, 2020
同意#8 老哥的
is_某种状态() -> 返回 bool check_status() -> 返回状态码 |
15
JerryCha Feb 14, 2020
isStatic
|
16
chen1164162915 Feb 14, 2020 function Sfzzyd(){
...... } |
17
Mohanson Feb 14, 2020
我的习惯是
``` enum Status { Running, Stop, } if A.status == Status.Running { } ``` 扩展性好, 万一以后加个检测是否在跳的需求, 不用加个 is_jump 函数... |
18
dangyuluo Feb 14, 2020
is_moving
|
19
Chingim Feb 14, 2020
Methods should have verb or verb phrase names like postPayment, deletePage, or save.
checkMovingStatus() -> bool |
20
Chingim Feb 14, 2020
如果是变量名, 那就用 isMoving
|
22
j140z1 Feb 14, 2020
isMoving or isInMotion
|
23
alya Feb 14, 2020
is_run()
|
24
crella Feb 14, 2020 via Android
def status_moving?
end |
26
hxtheone Feb 14, 2020
@GavinFlying #2 换到别的语言特别怀念 ruby 函数名里可以用 ? 和 !
|
27
w1573007 Feb 14, 2020 via Android
def shifozhengzaiyundong
|
28
LancerEvo Feb 14, 2020 via iPhone
正解是 is moving
命名含 if 的没有考虑调用的地方: if checkIfMoving... 不冗余? 命名含 check 的已经冗余了 if checkIsMoving... 这个 check 完全没必要 这点道理想不明白的我是不会招来当队友的 |
29
lastisee Feb 14, 2020
@GavinFlying 加一
|
30
hanhuoer Feb 14, 2020
function isMoving() {...}
|
31
arjen Feb 15, 2020
boolean isMoving();
所有返回类型是布尔值的我都用 is 开头 |