views:

22

answers:

1

Hi,

Should I put all my methods in one category (I mean for the same kind of object) or should I split them up in many files? (Something like NSStringAdditions vs. NSString+this and NSString+that)

+1  A: 

That very much depends.

If they are closely related to each other, put them in the same category. If they solve quite different tasks, then splitting them is appropriate.

Also, reusing in different projects my be a point to consider.

Always treat categories with care, though. Although it is possible to extend existing classes, and in some cases it is justified use, don't abuse them. They come at a cost (performance, flexibility, maintenance). So if you have to decide to split your category, this is most of the time a sign for too much complexity here, and a subclass or other helper class is the better choice.

Eiko
I'll keep all of that in mind.
Adam Lee