views:

42

answers:

3

I'm trying keep xcode chaos under control. Namely, how to reuse my small components/classes between projects. One strategy is to make every class, or tightly coupled collection of classes, in to a static library, each being a spawn of a different sub project with a few targets like unit tests, demos, and, of course, the library.

The way it looks now, I could I see a final app being composed of some custom code, and, say, a couple hundred libraries. That scares me, but should it? Would performance suffer? Are there other limitations to the many-library approach that would make it impractical?

+3  A: 

Having 100's of static libraries is not keeping chaos under control it's making it far worse. Grouping your code logically into static libraries is a great idea but one per class is far too fine grained. 100's of libraries equals hundreds of projects which is a lot of maintenance.

Gary
but, would it work? Would performance grind to a halt?
JJ Rohrer
It will have to have some impact on performance at some point as there is simply more work for xcode to do. I won't waste my time trying it but feel free to do so yourself and report your findings back here :)
Gary
A: 

After some offline-discussion, the consensus was that 100s of libraries would not slow down executions, but could be painful during linking.

The complexity of managing lots of libraries, could, of course, could make the solution worse than the disease.

JJ Rohrer
+1  A: 

If your concern is manageability, have you considered using svn:externals or git submodules?

It's a subdirectory from a different repository than the rest of your tree, so you can have multiple projects all using the latest version of your shared code in addition to a project just for testing that shared code. The file hierarchy would look something like:

tests/ <-- svn checkout

  • shared-code/
  • test-code/

project 1/ <-- svn checkout

  • shared-code/ <-- svn:external to tests/shared-code/
  • p1-specific-code/

project 2/ <-- svn checkout

  • shared-code/ <-- svn:external to tests/shared-code/
  • p2-specific-code/

There's a little svn dance to be done when tagging with svn:externals, and I believe git submodules require a different dance when updating their contents to HEAD, but those are both far from the headache involved with keeping common code in sync across multiple projects.

Justin Anderson
I am interested in techniques to manage the complexity and am, unfortunately, too familiar the pros and cons of git and svn. These can be great techniques for some circumstances.Right now, for this question, I'm only interested in the technical feasibility of having LOTS of libraries. Some technologies slow down, say, exponentially, and I was wondering if adding libraries fit into the category and was hoping to find someone with first hand experience.
JJ Rohrer