Picking good identifier names

前端 未结 10 989
猫巷女王i
猫巷女王i 2020-12-17 19:23

Ok, so you can read guidelines on identifier naming \'til you\'re blue in the face... camel case, pascal case, make \'em descriptive... but they won\'t help you actually pic

10条回答
  •  一整个雨季
    2020-12-17 19:51

    Picking terse, informative, appropriate names for things is one of the hardest parts of programming.

    There is no formula for it. It's a skill you pick up with experience.

    Notice the emphasis on terse. The long names in Java is one of the major turnoffs of that language. It basically has gotten to the point that it's impossible to program in Java without an IDE with autocomplete.

    Abbreviations can be your friend when naming. For instance, 'Mgr' instead of 'Manager'. Do I really need to type out 'Manager' a thousand times a day when 'Mgr' gets the point across? Just make sure people use them consistently and judiciously.

提交回复
热议问题