<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Observing Collections With Bindings</title>
	<atom:link href="http://www.red-sweater.com/blog/362/observing-collections-with-bindings/feed" rel="self" type="application/rss+xml" />
	<link>http://www.red-sweater.com/blog/362/observing-collections-with-bindings</link>
	<description>Mac &#38; Technology Writings by Daniel Jalkut</description>
	<lastBuildDate>Thu, 16 May 2013 21:58:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Daniel Jalkut</title>
		<link>http://www.red-sweater.com/blog/362/observing-collections-with-bindings/comment-page-1#comment-123428</link>
		<dc:creator>Daniel Jalkut</dc:creator>
		<pubDate>Thu, 28 Jun 2007 13:34:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/362/observing-collections-with-bindings#comment-123428</guid>
		<description><![CDATA[Peter: how do you define &quot;work?&quot; The point of mmalc&#039;s entry is to draw attention to the fact that it&#039;s not so simple to both observe the properties of items in a collection &lt;em&gt;and&lt;/em&gt; observe the membership of the collection.]]></description>
		<content:encoded><![CDATA[<p>Peter: how do you define &#8220;work?&#8221; The point of mmalc&#8217;s entry is to draw attention to the fact that it&#8217;s not so simple to both observe the properties of items in a collection <em>and</em> observe the membership of the collection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://www.red-sweater.com/blog/362/observing-collections-with-bindings/comment-page-1#comment-123310</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Thu, 28 Jun 2007 07:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/362/observing-collections-with-bindings#comment-123310</guid>
		<description><![CDATA[Is there a reason why the key path &lt;code&gt;@&quot;arrangedObjects.name&quot;&lt;/code&gt; wouldn&#039;t work? AFAIK, it would.]]></description>
		<content:encoded><![CDATA[<p>Is there a reason why the key path <code>@"arrangedObjects.name"</code> wouldn&#8217;t work? AFAIK, it would.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Paul Robinson</title>
		<link>http://www.red-sweater.com/blog/362/observing-collections-with-bindings/comment-page-1#comment-119988</link>
		<dc:creator>David Paul Robinson</dc:creator>
		<pubDate>Sat, 23 Jun 2007 13:08:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/362/observing-collections-with-bindings#comment-119988</guid>
		<description><![CDATA[Another option is to have your derived NSManagedObject handle the change and notification itself in its setter.  Of course this still requires a custom model object.]]></description>
		<content:encoded><![CDATA[<p>Another option is to have your derived NSManagedObject handle the change and notification itself in its setter.  Of course this still requires a custom model object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens Ayton</title>
		<link>http://www.red-sweater.com/blog/362/observing-collections-with-bindings/comment-page-1#comment-119272</link>
		<dc:creator>Jens Ayton</dc:creator>
		<pubDate>Fri, 22 Jun 2007 09:52:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/362/observing-collections-with-bindings#comment-119272</guid>
		<description><![CDATA[I’m not much of a bindings fan, but I’ve got to agree with Brian about keeping the use of collection objects to simple cases. Working with Oolite has reinforced this, as it uses some pretty complex property list structures, some read from disk and merged together, some generated at runtime. When they were being implemented, it probably made sense, but coming in afterwards and unravelling them can be a nightmare.

I prefer to use hierarchies of simple model objects, which may or may not be wrappers for Foundation collections. This basically gives me the advantage of strong typing with introspection (even though I’m not a hardcore strong typing fan) – if something weird is happening in the middle of a structure, it’s generally possible to work out what type of data I’m supposed to be providing, etc.]]></description>
		<content:encoded><![CDATA[<p>I’m not much of a bindings fan, but I’ve got to agree with Brian about keeping the use of collection objects to simple cases. Working with Oolite has reinforced this, as it uses some pretty complex property list structures, some read from disk and merged together, some generated at runtime. When they were being implemented, it probably made sense, but coming in afterwards and unravelling them can be a nightmare.</p>
<p>I prefer to use hierarchies of simple model objects, which may or may not be wrappers for Foundation collections. This basically gives me the advantage of strong typing with introspection (even though I’m not a hardcore strong typing fan) – if something weird is happening in the middle of a structure, it’s generally possible to work out what type of data I’m supposed to be providing, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Webster</title>
		<link>http://www.red-sweater.com/blog/362/observing-collections-with-bindings/comment-page-1#comment-119010</link>
		<dc:creator>Brian Webster</dc:creator>
		<pubDate>Thu, 21 Jun 2007 22:48:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/362/observing-collections-with-bindings#comment-119010</guid>
		<description><![CDATA[Yeah, I find myself wanting to do this sort of thing all the time.  For example, if I&#039;m managing a table that needs to refresh anytime property X of one of the items changes, it means observing that property for each object displayed.  This also means you need to add/remove yourself as an observer when items are added/removed from the list.

I did this often enough that I ended up writing a generic set of routines (a start, an update, and an end) that will observe key paths of every object in a to-many KVC relationship.  It works pretty much the same way as in the GraphicsBinding example on mmalc&#039;s page, but it takes arbitrary keys as arguments.

The start routine sets up the initial observations, then you can call the update routine from observeValueForKeyPath:... and just pass it the change NSDictionary, and it adds/removes observers as necessary for newly added/removed objects.  Then there&#039;s also an end routine that tears everything down after you&#039;re done.  It&#039;s the kind of code that&#039;s a pain to write, but once you&#039;ve got it written in a reusable form, it&#039;s very very handy to have around.

I also tend to only use dictionaries to store things for very very simple cases.  My experience is that once too many keys get involved, it&#039;s just to easy to get confused as to what&#039;s what, so making an actual class with defined methods helps keep things straight.  The temptation is always there though. :-)]]></description>
		<content:encoded><![CDATA[<p>Yeah, I find myself wanting to do this sort of thing all the time.  For example, if I&#8217;m managing a table that needs to refresh anytime property X of one of the items changes, it means observing that property for each object displayed.  This also means you need to add/remove yourself as an observer when items are added/removed from the list.</p>
<p>I did this often enough that I ended up writing a generic set of routines (a start, an update, and an end) that will observe key paths of every object in a to-many KVC relationship.  It works pretty much the same way as in the GraphicsBinding example on mmalc&#8217;s page, but it takes arbitrary keys as arguments.</p>
<p>The start routine sets up the initial observations, then you can call the update routine from observeValueForKeyPath:&#8230; and just pass it the change NSDictionary, and it adds/removes observers as necessary for newly added/removed objects.  Then there&#8217;s also an end routine that tears everything down after you&#8217;re done.  It&#8217;s the kind of code that&#8217;s a pain to write, but once you&#8217;ve got it written in a reusable form, it&#8217;s very very handy to have around.</p>
<p>I also tend to only use dictionaries to store things for very very simple cases.  My experience is that once too many keys get involved, it&#8217;s just to easy to get confused as to what&#8217;s what, so making an actual class with defined methods helps keep things straight.  The temptation is always there though. :-)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

 Served from: www.red-sweater.com @ 2013-05-22 15:56:43 by W3 Total Cache -->