title: What is better: Global string or singleton?
body: <p>For my brand new ORM (<a href="http://code.google.com/p/chibiorm/" rel="nofollow noreferrer">chibi-ORM</a>) I face a design decision.</p>
  
  <p>I'm building the API for relationships, like:</p>
  
  <pre><code>@interface SamplePerson : DbObject {
      NSString *name;
          DbObjectRelation *cities;
  }
  </code></pre>
  
  <p>Now, for <code>DbObjectRelation</code> I have this mockup:</p>
  
  <pre><code>@interface DbObjectRelation : NSObject {
      NSMutableArray *childRows;
      DbObject *parent;
      BOOL isLoaded;
  }
  
  -(void) load;
  
  -(void) addObject:(DbObject *) childRow;
  -(void) removeObject:(DbObject *) childRow;
  
  - (id)initWitParent:(DbObject *)parentObject;
  </code></pre>
  
  <p>So, I need a way inside load of know which database use for load the records.</p>
  
  <p>I think in have in my DB connection something like:</p>
  
  <pre><code>static NSString *currentDbNameSingleton = nil;
  
  +(NSString *)currentDbName {
      @synchronize( self ) {
          if ( currentDbNameSingleton == nil ) {
              currentDbNameSingleton = [[NSString alloc]
          }
      }
      return sharedInst;  
  }
  
  +(void) setCurrentDbName(NSString *)name {
      @synchronize( self ) {
        currentDbNameSingleton = [name copy];
      }
  }
  </code></pre>
  
  <p>But wonder if is better build the DB class as a singleton. This is for iPhone projects...</p>