Reputation: 3852
Here is the interface of my object:
@interface MyItem : NSObject {
sqlite3 *database;
NSInteger *primaryKey;
NSInteger *accountKey;
NSInteger *categoryKey;
NSString *title;
BOOL hydrated;
BOOL dirty;
NSData *data; // Why do I need this?
}
The primary key will be auto generated in Sqlite and I am storing the integers, foreign keys of account and category in the MyItem table.
The account and category will have a meaningful description. Should I add properties for the descriptions as well? Like so:
NSString *accountDesc;
NSString *categoryDesc;
So that in my Hydrate method I can do a join to category and account.
What is the best practice to do this?
My goal is on the initial launch of the App, I will display a Tableview with title and category descriptions.
Upvotes: 1
Views: 706
Reputation: 9796
Why not use Core data? You will get the best practice then - plus it is fast and it gives loads of other benefits.
Core data would create objects for you with exposed properties - and handle relationships - and lazily load the objects to make memory management much eaiser. You code becomes much easier to read too.
Upvotes: 5