I'm currently thinking about the modeling of data in an iPhone app. My first instinct is to try to normalize the data into entities.
For example a Professor entity might look something ilke this:
@interface Professor : NSManagedObject {
}
@property (nonatomic, retain) NSString * profID;
@property (nonatomic, retain) NSString * firstName;
@property (nonatomic, retain) NSString * lastName;
@property (nonatomic, retain) NSString * officeLocation;
@end
And an AvailableClass might look like this:
@interface AvailableClass : NSManagedObject {
}
@property (nonatomic, retain) NSString * className;
@property (nonatomic, retain) NSString * classAbstract;
@end
Now, we can pair the professors against the classes they teach using something like this:
@interface OfferedClass : NSManagedObject {
}
@property (nonatomic, retain) Professor * prof;
@property (nonatomic, retain) AvailableClass * classDetail;
@end
If I want a view which lists a catalog of all
OfferedClasses
(that is, there is a professor assigned to a defined class) does this mean I need multipleFetchRequestControllers
and that I'll be doing multple queries in mytableView: cellForRowAtIndexPath:
method?It appears to me that I can create and add instances of
Professor
andAvailableClass
, then later add instances ofOfferedClass
by getting values forprof
andclassDetail
from their respectivefetchedResultsController
.
Am I close on any of this?