Re: Should I use Core Data?
Re: Should I use Core Data?
- Subject: Re: Should I use Core Data?
- From: Greg Herlihy <email@hidden>
- Date: Thu, 20 Apr 2006 15:08:19 -0700
- Thread-topic: Should I use Core Data?
In the data model of a drawing program a rectangle would be be an object of
its own. So any other object that has a rectangle property would represent
that property - not by storing an encoded description of a rectangle in a
string - but by creating a one-to-one relationship with a Rectangle object.
The Rectangle object in turn would have its own properties - its left, top,
right, bottom edges (and two transient properties calculated from the first
four: width and height). Since all of these values are primitive types
without need of breaking down any further, they would be stored as
attributes of the Rectangle object.
The Rectangle must be its own class in order for the program to find those
objects whose rectangle intersects a given area (such as the document's
visible area) and to do so quickly and efficiently. With Core Data, this
kind of operation can even be built-in to the data model itself as a fetched
property - meaning that many common operations of the app can be implemented
without writing any source code at all. Essentially, if the app doesn't use
Core Data, then it will have to implement something to use in its place.
And I don't see any reason why the file format would much matter in this
case. SVG describes an object model as does Core Data. So an SVG drawing
program merely has to be able to build a CD object graph from the contents
of an SVG file and likewise to generate an SVG file from a CD object graph
in memory. Neither of which operations pose any great technical challenges -
and as already noted - are both exactly the kinds of tasks that the
application will have to perform anyway - whether it uses CD or not.
Greg
On 4/20/06 1:51 PM, "Ondra Cada" <email@hidden> wrote:
> David,
>
> On 20.4.2006, at 22:37, Joshua Scott Emmons wrote:
>
>> ... Instead of storing myRect you'd store NSStringFromRect(myRect)
>
> to bump the efficiency up somewhat you could use +[NSValue
> valueWithRect:] instead. NSValue is a gem pretty often overlooked :)
> ---
> Ondra Čada
> OCSoftware: email@hidden http://www.ocs.cz
> private email@hidden http://www.ocs.cz/oc
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden