views:

118

answers:

1

Would NSSortDescriptor subclasses be placed in the Model or the Controller layer?

Since they are primarily for display and business logic, it seems to make sense to put them in the Controller layer. But it also makes sense that models should know how to sort themselves.

+2  A: 

NSSortDescriptor… subclasses?

models should know how to sort themselves.

Sorting is a presentation-to-the-user issue, which makes it more the domain of views and controllers; models generally should stay out of such things.

In Cocoa, you instantiate NSSortDescriptor, and you keep these descriptors in an array, to be used by whatever wants to sort things with them. I cannot think of a reason to subclass NSSortDescriptor.

Peter Hosey
Wow, you're right. I misread the class docs. Thanks!
Adam Ernst