Direct To Cocoa App, or How Does D2WContext Work Anyway? (Somewhat OT)
Direct To Cocoa App, or How Does D2WContext Work Anyway? (Somewhat OT)
- Subject: Direct To Cocoa App, or How Does D2WContext Work Anyway? (Somewhat OT)
- From: Amy Worrall <email@hidden>
- Date: Sat, 03 Mar 2012 17:21:51 +0000
Hi all. Hope you're well.
I work as an iOS developer, and we frequently find ourselves in need
of internal tools for editing Core Data files of the data that will be
put into our apps. These tools need to be usable by non-techies, but
they don't need to be beautiful, and usually I throw something
together in Xcode with Cocoa bindings.
Lately I've been thinking about automating the creation of such tools
based on introspection of the Core Data model, with some kind of
configuration file to specify the specific views I wanted and to
customise various bits of behaviour. I then realised I was just
inventing the Cocoa equivalent of Direct To Web. I'm probably going to
have a stab at making this, and I hope to be able to keep the design
similar to D2W so I can gain the benefit of all the work put into its
APIs. Also I'll be able to use Rule Editor to edit my config files.
My plan is to write a framework to facilitate building MacOS X apps in
the same way D2W facilitates dynamic web sites. Sticking close to way
D2W works, I'm going to have the equivalent of a D2WPage be something
along the lines of an NSViewController in Mac-land. I'm going to steal
D2WModel, D2WContext and the D2W factory, and I'm going to use similar
keys in the rules (still based around task, entity,
displayPropertyKeys etc). Just to be clear, while I'm doing something
inspired by D2W it will be lesser in scope, and I'm sure I'll change a
bunch of things too (especially things that don't make sense in
desktop-land).
One final point to mention: I haven't really used Direct To Java
Client (at least, I used it briefly in WO 5.2 days, and barely
customised anything), and I can't find any documentation about how it
works (worked?), so at the moment I'm not taking any inspiration from
there.
Anyhow, background over, on to questions:
I'm currently learning about how the logic flow works for D2W. As far
as I understand it, a D2WPage subclass instance is created either by
the factory or by another page. A page always has an entity and a
task. Some kinds of page (inspect, edit) have an object. Any
D2WComponent (including a page) has access to a D2WContext. The
context represents some bits of state when creating the pages. The
context has access to the D2WModel, which is an object containing all
the rules from the rules files.
A D2WContext stores some state, such as the current entity, the
current property key, etc… who sets them? Does the D2WComponent that's
currently being rendered set those things on the D2WContext first,
before querying things that the context might have to evaluate rules
for?
Is there just one D2WContext that is passed around, with its
properties reset for each component it comes across, or is there a
brand new one created every time a component is displayed? I know
there's an initialiser that takes a parentContext attribute, so that
suggests that a new one is created for each component but initialised
by default to the values of the D2WContext for the containing
component… is that right?
Leaving aside the issue of cacheing, are there a set of keys that the
D2WContext stores as state, and everything else is in the rules system
and can be recomputed on the fly if necessary?
Thanks for your help,
Amy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden