When is a function name too long?

后端 未结 27 2258
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 18:45

I try to be rather descriptive with my function names, where possible. This occasionally results in function names in the twenty to thirty character range such as \"GetActionFr

27条回答
  •  没有蜡笔的小新
    2021-02-03 19:13

    Trying to avoid subjectivity:

    When names get to be about 1/3 of whatever your typical line length is, then you're stretching it. At 1/2 line length you're too far gone. One statement per line gets pretty tough when the names take up the whole line.

    Beyond that, most IDEs support completion (thereby saving the programmer from actually typing most names out fully), so the more important thing to do, in my opinion, is make sure that the name is as unique as possible as soon as possible.

提交回复
热议问题