Take the 2-minute tour ×

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)

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
I'll keep all of that in mind. –  Adam Lee Jul 4 '10 at 10:10
add comment

Your Answer


