I used Core Data for a while, but I just asked myself a question: I always always create some kind of local storage class from which I control the Core Data model, it will be a singleton class that has a link to the context of the managed object, I have methods for creating new managed objects, deleting objects, saving, etc .... And my subclasses of Managed Object are really just models.
But I often worked with projects of other nations, and sometimes other developers tend to add more logic to subclasses of managed objects in the form of class methods and have a very simple or sometimes missing class for wrapping kernel data for everything.
For example, I would usually do something like this:
User *me = [[MyDataStore getInstance] createUserWithName:@"Daniel"];
While others are more likely to have:
User *me = [User userWithName:@"Daniel"];
Obviously, the latter is much nicer and, in my opinion, more human-friendly, but in the end there may be a lot of fragmented code, but, on the other hand, my decision means that you have a very large file that is small, passes by a certain lengths.
I wondered if others could share their point of view on this. Thanks.
source share