When is a function name too long?

后端 未结 27 1646
伪装坚强ぢ
伪装坚强ぢ 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:03

    From Code Complete (1st Edition, page 188)

    "Gorla, Benander and Benander found that the effort required to debug a COBOL program was minimized when variables had names that averaged 10 to 16 characters (1990). Programs with names averaging 8 to 20 characters were almost as easy to debug."

    This constitutes the only empirical discussion of a reasonable guideline for variable name length I've ever seen. Everything else is down to opinion and comfort.

提交回复
热议问题