1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Conflicting Global Class Names?

Discussion in 'Mac Programming' started by Darkroom, Jun 11, 2008.

  1. Guest


    i've just read the following:

    "To keep the global variables from conflicting with another company's global variables, you have prefixed them with BNR (for Big Nerd Ranch). Global variables from Cocoa are prefixed with NS. These prefixes are important only when you start using classes and frameworks developed by third parties. (NOTE that class names are also global. You might prefer to prefix all your class names with BNR to keep them from conflicting with anyone else's classes)"

    i understand it's extremely common for developers to have certain classes often titled the same, namely "AppController". so if two applications are running on one computer, and both applications have classes called "AppController", will they conflict with one another?
  2. macrumors 68040


    No. This is only for cases of code reuse through libraries, etc. Conflicts will only occur if the classes are defined in the same namespace in one program.

    If I wrote a great graphing library, but called my classes MyClass, MyController, AppController, etc. there's a high probability when someone tried to use it in their program, they'd have issues using my library with some classes they already have. If I called a class NSArray, you couldn't use it with the foundation classes, so you couldn't use it in any project, really.

  3. Guest


    ok, understood. thanks for clearing that up for me :)

Share This Page