Delegate variables Vs. Core Data
I wonder when I should use Core Data and when I just should开发者_如何学JAVA keep it easy and use delegate variables?
Delegate is a design pattern, CoreData a persistence framework. You are comparing things, that are not compare-able.
Edit
Delegate:
A delegate is an "entry point" where an objects allows you to define some custom action. It is similair to callbacks in some language or interface in Java. Technically a delegate is just a pointer to an object that conforms to a defined protocol
Delegation is a simple and powerful pattern in which one object in a program acts on behalf of, or in coordination with, another object. The delegating object keeps a reference to the other object—the delegate—and at the appropriate time sends a message to it. The message informs the delegate of an event that the delegating object is about to handle or has just handled. The delegate may respond to the message by updating the appearance or state of itself or other objects in the application, and in some cases it can return a value that affects how an impending event is handled. The main value of delegation is that it allows you to easily customize the behavior of several objects in one central object.
CoreData
CoreData is a Framework for organizing persistence data.
In simplest terms, Core Data is an object graph that can be persisted to Disk. [...] Core Data can do a lot more for us. It serves as the entire model layer for us. It is not just the persistence on disk, but it is also all the objects in memory that we normally consider to be data objects.
—Marcus Zarra, Core Data
精彩评论