Picking good identifier names

前端 未结 10 995
猫巷女王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:42

    Like kekoav, I am wary of naming something FooManager or FooController. Not only is it indicative of an object that suffers from an identity crisis, but it introduces ambiguity. I've worked on a project where there was an "AccountManager", which was a domain object representing a person who managed accounts (a subtype of Employee). Of course, someone made an "AccountManagerManager", and someone else got confused and created an Account domain object (which wasn't something our app was dealing with), then mixed stuff into AccountManager to manage the Account. It was kind of a mess.

    Quis custodiet ipsos custodes? Quoque quis administro ipsos administratorum?

    Yeah, my Latin is rusty.

提交回复
热议问题