The Object Graph in ObjectiveC

The object graph is all the stuff in your applications model (the model part of view and controller).   This stuff includes not only the objects, but also the relationships between the objects.  Understanding what an object graph is and how it relates to your iOS application will make things like Core Data tons easier to understand.

Let’e recall some object oriented vocabulary first.

Entity

An entity is the abstraction of something that we are working on. Usually, this is something from the real world or a metaphor for an abstract problem. When I use the word entity, I’m referring to the abstraction itself and not to any particular implementation in code.

Entities are usually described in terms of attributes and behaviors. So, if I’m thinking of a car entity I would probably describe a car that has attributes like: the color red, four tires and sport trim. Car behavior would include driving, braking and turning.

Class

A class is the code used to represent an entity inside of our application. This is where we define what an entity is and does inside of our application. The process involves thinking of the entity and using code to represent the entity as an interface and implementation. We code an entity’s attributes in a class as properties and an entities behavior in a class as methods.

Many people compare class definitions to blueprints.

Objects

By itself, a class is just a definition of something and doesn’t do much. To use a class, you must instantiate an object from a class. An object is a particular instance of a class and you will usually have many objects created from a class definition. Objects are composed of other objects as is specified in the object’s class definition.

The Object Graph

The object graph is an application’s network of objects and their relationships. These are the objects that are created and used when a user is actively using an application. The object graph can quickly become very rich and complicated as the user starts to create objects from our class definitions. You can think of your object graph in terms of every object in your application, including system and user interface objects.

More likely, you will think of your object graph as the objects that are part of your data model.

Note The data model refers to the Model part of a design pattern called Model-View-Controller (MVC) that splits the responsibilities of an application into three areas: the Model (your representation of the entities you are working with), the View (the user interface) and the Controller (the connection between the Model and the View).

http://howtomakeiphoneapps.com/the-object-graph-in-objective-c/1811/



签名:删除冗余的代码最开心,找不到删除的代码最痛苦!
原文地址:https://www.cnblogs.com/season2009/p/2546637.html