When is a function name too long?

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

    IMHO, it is much more important for functions to be descriptive. IDEs help much avoiding the trouble of mispelling or something like that. I think its ok to use abbreviations sometimes, as long as they are consistent through the code (no different abbreviations for the same thing, nor same abbreviation for two different things.

    0 讨论(0)
  • 2021-02-03 19:06

    IMO, it's too long when it has a conjunction in it. "When", "And", "Then", ... anything like that. Following the One Responsibility Rule should allow function names that are long enough to be descriptive and short enough not to be ridiculously annoying.

    0 讨论(0)
  • 2021-02-03 19:08

    When you can't read them aloud anymore without taking a breath in the middle =D

    0 讨论(0)
  • 2021-02-03 19:08

    When it doesn't do everything that it says it does. ;)

    0 讨论(0)
  • 2021-02-03 19:09

    TheFunctionNameBecomesTooLongWhenItBecomesTooHardToReadItAndUnderstandIt, on the other hand it_dependends_on_nameing_convention_how_hard_function_reading_is_sometimes_long_names_are_readable.

    0 讨论(0)
  • 2021-02-03 19:10

    When you start to think it :)

    0 讨论(0)
提交回复
热议问题