Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the best way to organize source code of a large Cocoa application in Xcode?
    primarykey
    data
    text
    <p>Here is what I'm looking for: </p> <p>I'd like to separate pieces of functionality into modules or components of some sort to <em>limit visibility of other classes to prevent that each class has access to every other class</em> which over time results in spaghetti code.</p> <p>In Java &amp; Eclipse, for example, I would use packages and put each package into a separate project with a clearly defined dependency structure.</p> <p>Things I have considered:</p> <ol> <li>Using <strong>separate folders</strong> for source files <strong>and using Groups in Xcode</strong>: <ul> <li>Pros: simple to do, almost no Xcode configuration needed</li> <li>Cons: no compile-time separation of functionality, i.e. access to everything is only one <code>#import</code> statement away</li> </ul></li> <li><strong>Using Frameworks</strong>: <ul> <li>Pros: Framework code cannot access access classes outside of framework. This enforces encapsulation and keeps things separate</li> <li>Cons: Code management is cumbersome if you work on multiple Frameworks at the same time. Each Framework is a separate Xcode project with a separate window</li> </ul></li> <li><strong>Using Plugins</strong>: <ul> <li>Pros: Similar to Frameworks, Plugin code can't access code of other plugins. Clean separation at compile-time. Plugin source can be part of the same Xcode project.</li> <li>Cons: Not sure. This may be the way to go...</li> </ul></li> </ol> <p>Based on your experience, what would you choose to keep things separate while being able to edit all sources in the same project?</p> <p><strong>Edit:</strong></p> <ul> <li>I'm targeting Mac OS X</li> <li>I'm really looking for a solution to enforce separation at compile time</li> <li>By plugins I mean Cocoa bundles (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingCode/Concepts/Plugins.html)</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload