Here is what I'm looking for:
I'd like to separate pieces of functionality into modules or components of some sort to limit visibility of other classes to prevent that each class has access to every other class which over time results in spaghetti code.
In Java & Eclipse, for example, I would use packages and put each package into a separate project with a clearly defined dependency structure.
Things I have considered:
- Using separate folders for source files and using Groups in Xcode:
- Pros: simple to do, almost no Xcode configuration needed
- Cons: no compile-time separation of functionality, i.e. access to everything is only one
#import
statement away
- Using Frameworks:
- Pros: Framework code cannot access access classes outside of framework. This enforces encapsulation and keeps things separate
- 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
- Using Plugins:
- 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.
- Cons: Not sure. This may be the way to go...
Based on your experience, what would you choose to keep things separate while being able to edit all sources in the same project?
Edit:
- I'm targeting Mac OS X
- I'm really looking for a solution to enforce separation at compile time
- By plugins I mean Cocoa bundles (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingCode/Concepts/Plugins.html)