Re: core data app questions - help!
Re: core data app questions - help!
- Subject: Re: core data app questions - help!
- From: Ricardo Strausz <email@hidden>
- Date: Sat, 1 Sep 2007 18:49:33 -0500
Hola mmalc!
On Sep 1, 2007, at 5:41 PM, mmalc crawford wrote:
On Sep 1, 2007, at 9:57 AM, Ricardo Strausz wrote:
But the main thing to have in mind is that if you have a good
model, you can fetch (see) your data in many ways, just by free.
This us at best misleading; fetches in general are *not* free -- a
fetch causes Core Data to go back to the persistent store, which is
an expensive operation.
You can certainly fetch your data in many ways, but constructing
the correct fetch request is itself not always conceptually free
(i.e. you have to think about it).
While I was writing that, I was thinking in the following scenario:
1. it is a small app
2. it is using SQLite as persistence
3. the S-->>W relation gives me a "free" fetch of Ws, just by
clicking in the S table view
Also, you may have to adjust your interface to.
Well, yes...
;^)
As I understand, your model is something like W<<-->S : W<<-->I
(with the obvious meanings).
The easiest part is to put at work your to-many relations: any of
the tutorials that come with the tools will explain (in
particular, see http://developer.apple.com/cocoa/coredatatutorial/
index.html )
This explains how to create a "default" interface using bindings.
Like Core Data, bindings are not a beginner technology.
It is not that difficult —and hopefully it is understandable to
someone doing differential equations in C++ (right Jacob?)
If you're able to create your application solely using drag-and-
drop/point-and-click technologies, then fine. But typically
there's more to it than that and if you don't understand the
fundamentals on which those technologies are based then you're left
several levels of abstraction up in the air with no idea how to
progress...
Only experience will drag you deeper in the Framework...
For number one, I would recommend to add an entity with dates, and
with relations W<<-->D, so by clicking in a date you can see only
those objects in W with that date... if this can be done with a
nicer interface (a calendar) will be your research – please let us
know ;^)
It's not clear exactly what this means or how it helps.
It is just an idea of how implement the "free" fetch described below.
If whenever you insert a new W, you also insert a new D —with its
proper relation— you can bring back your Ws by clicking in the
appropriate D...
Adding some extra code, the contents of D can be showed in a more
"fashionable" way...
For the last, you will have to implement a notification centre
that advise you whenever the table changes, so you can calculate
the needed sum using something like [[table displayedObjects] @sum
(duration)].
Again this is at best misleading -- the precise mechanism used to
propagate change notifications will depend on the application
architecture implemented. Moreover, there is no 'displayedObjects'
method, and you cannot send a @sum(duration) message. *If* you're
using bindings, then you might *bind* the 'value' of a text field
to the sum of duration properties of the *arrangedObjects* in a
relevant array controller.
mmalc, mmalc... of course this was not meant to be taken literally...
I meant to construct an array of the displayed objects and, via KVC —
or with a classic loop if you will— calculate the desired sum; I
wanted to emphasise that some code should be written (because I was
not sure that such a deviated value can be binded).
BTW, there may be a good delegate method which allows to run such a
code on-time... can't remember now :-(
HIH
Dino
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden