When is a function name too long?

后端 未结 27 1557
伪装坚强ぢ
伪装坚强ぢ 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 18:47

    1. If you have to scroll to the right to read it.
    2. Describes the 3 or more things that is does - it shouldn't do that many things.
    3. Your boss thinks its too long.
    4. It's longer than the code itself.
    5. It starts with Get, just like 500 other functions.
    6. Nobody wants to use it.
    7. There is another function that does the same thing with a shorter name that users understand.
    8. It can be made shorter.

提交回复
热议问题