Search code examples
iosuiviewcontrollerxcode4naming-conventions

iOS - Abbreviating XXXViewController to XXXVC bad or ok?


Since every view controller ends with "ViewController" would it be evil to simply abbreviate it as "VC"? I know the Apple Docs say not to abbreviate things and make the names meaningful but isn't this something that's just obvious what it is? I find it lengthy and verbose to type ViewController after every single one. Also, xcode 4 automatically names the nib file the same as the header and class files. Do you remove the "Controller" part of it?

What are your naming conventions and why did you choose to do it that way?

Thanks


Solution

  • If you're using Xcode, you shouldn't have to type the full name every time. Auto-complete handles that for you.

    In general, avoiding abbreviation makes your code more readable and easier to maintain. Sure you know what VC means, but someone else 3 years from now might not understand what you were doing.

    In this specific case, it may not make tons of sense, but naming conventions are conventions. We follow them in most cases to make our lives (and others) easier in the future.

    Always imagine that the person who will eventually maintain your code is a big mean guy with a hair-trigger temper who knows where you live.