<?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: The Cocoa-Carbon Advantage</title>
	<atom:link href="http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/feed" rel="self" type="application/rss+xml" />
	<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage</link>
	<description>Mac &#38; Technology Writings by Daniel Jalkut</description>
	<lastBuildDate>Wed, 17 Mar 2010 22:33:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Daniel Jalkut</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-2#comment-16501</link>
		<dc:creator>Daniel Jalkut</dc:creator>
		<pubDate>Wed, 27 Sep 2006 17:34:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-16501</guid>
		<description>Agree with Eric, especially considering that there are behaviors that are better in Carbon than in Cocoa. So it goes both ways. And if Apple didn&#039;t want to support Carbon, they would have made that a lot clearer than just a few UI glitches. Remember Classic?</description>
		<content:encoded><![CDATA[<p>Agree with Eric, especially considering that there are behaviors that are better in Carbon than in Cocoa. So it goes both ways. And if Apple didn&#8217;t want to support Carbon, they would have made that a lot clearer than just a few UI glitches. Remember Classic?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Albert</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-2#comment-16499</link>
		<dc:creator>Eric Albert</dc:creator>
		<pubDate>Wed, 27 Sep 2006 17:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-16499</guid>
		<description>I&#039;d suggest not ascribing to politics what can more easily be explained by there being more important things to fix.</description>
		<content:encoded><![CDATA[<p>I&#8217;d suggest not ascribing to politics what can more easily be explained by there being more important things to fix.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neo</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-2#comment-16428</link>
		<dc:creator>Neo</dc:creator>
		<pubDate>Wed, 27 Sep 2006 04:38:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-16428</guid>
		<description>Sadly this demonstrates why one must prefer one part of OS X over the other: Carbon is out of sync from Cocoa (and vice versa).

The icon returned should be exactly the same, but NSWorkspace is apparently doing some voo-doo to get the *most current* preferred icons. ThIs implies that NSWorkspace is designed to go and get a different icon than what is actually defined in the bowels of OS X.

This preferential treatment of Cocoa is what really irks (some) old-school Carbon developers. Apple engineers are intentionally making Carbon appear antiquated or &quot;broken&quot; compared to Cocoa, even though Carbon is technically capable of regurgitating the correct, modern, icon.

Another area where Carbon is deliberately hindered vs. Cocoa is in the &quot;grow thumb&quot; in Carbon windows, which appears as a solid-white background square instead of transparent as in Cocoa-derived windows. Carbon can make the grow thumb appear identical to Cocoa windows, it is simply not the default appearance for no technical reason whatsoever (just political ones, methinks, but what do I know).</description>
		<content:encoded><![CDATA[<p>Sadly this demonstrates why one must prefer one part of OS X over the other: Carbon is out of sync from Cocoa (and vice versa).</p>
<p>The icon returned should be exactly the same, but NSWorkspace is apparently doing some voo-doo to get the *most current* preferred icons. ThIs implies that NSWorkspace is designed to go and get a different icon than what is actually defined in the bowels of OS X.</p>
<p>This preferential treatment of Cocoa is what really irks (some) old-school Carbon developers. Apple engineers are intentionally making Carbon appear antiquated or &#8220;broken&#8221; compared to Cocoa, even though Carbon is technically capable of regurgitating the correct, modern, icon.</p>
<p>Another area where Carbon is deliberately hindered vs. Cocoa is in the &#8220;grow thumb&#8221; in Carbon windows, which appears as a solid-white background square instead of transparent as in Cocoa-derived windows. Carbon can make the grow thumb appear identical to Cocoa windows, it is simply not the default appearance for no technical reason whatsoever (just political ones, methinks, but what do I know).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Herring</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-1#comment-15396</link>
		<dc:creator>Nathan Herring</dc:creator>
		<pubDate>Tue, 19 Sep 2006 18:12:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-15396</guid>
		<description>Alas, there are two issues with using Cocoa intermixed with Carbon that have a deleterious effect on performance.
(1) Loading of extra libraries at launch (not a terribly big deal)
(2) You cannot unload Cocoa-based bundles as the Objective-C runtime cannot guarantee that all objects lifetimes are terminated.
That said, the post and the comments are spot on.</description>
		<content:encoded><![CDATA[<p>Alas, there are two issues with using Cocoa intermixed with Carbon that have a deleterious effect on performance.<br />
(1) Loading of extra libraries at launch (not a terribly big deal)<br />
(2) You cannot unload Cocoa-based bundles as the Objective-C runtime cannot guarantee that all objects lifetimes are terminated.<br />
That said, the post and the comments are spot on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Louis</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-1#comment-14457</link>
		<dc:creator>Louis</dc:creator>
		<pubDate>Tue, 12 Sep 2006 12:35:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-14457</guid>
		<description>Cocoa is excellent for interfaces, but sadly it lacks a lot of things that can be found in carbon. I prefer cocoa, but I&#039;m not afraid to use carbon where cocoa falls short.</description>
		<content:encoded><![CDATA[<p>Cocoa is excellent for interfaces, but sadly it lacks a lot of things that can be found in carbon. I prefer cocoa, but I&#8217;m not afraid to use carbon where cocoa falls short.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Thomas</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-1#comment-14328</link>
		<dc:creator>Chris Thomas</dc:creator>
		<pubDate>Mon, 11 Sep 2006 03:09:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-14328</guid>
		<description>Daniel: I, too, have Carbon icon code in some of my Cocoa apps. I think there is a point being overlooked in the discussion of NSWorkspace vs GetIconRef. IconServices was designed (partly) to minimize memory usage: for each icon on the system, there should be one and only one instance of pixel data/cache in memory, and all applications should render the icon from that same instance data via PlotIconRef.

So, try this:

Call [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(&#039;prof&#039;)]; three times in the same function, logging the result with NSLog(&quot;%@&quot;) after each.

Call GetIconRef and printf(&quot;%08lX&quot;) the resulting iconRef three times.

Notice the difference? (Aside from the much richer description returned by NSLog...)

This is a much bigger problem with file-specific icons retrieved through NSWorkspace, where you might invoke iconForFile: way too often if you aren&#039;t aware of the problem. You can cache the generic icon (still once per app rather than once per system, though). File-specific icons, not so much.

Rosyna: What does Cocoa have to do with Aperture&#039;s slowness, especially in the 1.0? Unless they ported it to Carbon in 1.1, I find it unlikely that you can pin that on Cocoa. But if you can really trace Aperture&#039;s performance issues to indiscriminate use of Cocoa rather than Carbon, I and others would certainly like to see the analysis.</description>
		<content:encoded><![CDATA[<p>Daniel: I, too, have Carbon icon code in some of my Cocoa apps. I think there is a point being overlooked in the discussion of NSWorkspace vs GetIconRef. IconServices was designed (partly) to minimize memory usage: for each icon on the system, there should be one and only one instance of pixel data/cache in memory, and all applications should render the icon from that same instance data via PlotIconRef.</p>
<p>So, try this:</p>
<p>Call [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(&#8216;prof&#8217;)]; three times in the same function, logging the result with NSLog(&#8220;%@&#8221;) after each.</p>
<p>Call GetIconRef and printf(&#8220;%08lX&#8221;) the resulting iconRef three times.</p>
<p>Notice the difference? (Aside from the much richer description returned by NSLog&#8230;)</p>
<p>This is a much bigger problem with file-specific icons retrieved through NSWorkspace, where you might invoke iconForFile: way too often if you aren&#8217;t aware of the problem. You can cache the generic icon (still once per app rather than once per system, though). File-specific icons, not so much.</p>
<p>Rosyna: What does Cocoa have to do with Aperture&#8217;s slowness, especially in the 1.0? Unless they ported it to Carbon in 1.1, I find it unlikely that you can pin that on Cocoa. But if you can really trace Aperture&#8217;s performance issues to indiscriminate use of Cocoa rather than Carbon, I and others would certainly like to see the analysis.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: frank riffold</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-1#comment-14281</link>
		<dc:creator>frank riffold</dc:creator>
		<pubDate>Sun, 10 Sep 2006 21:42:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-14281</guid>
		<description>In some (non-gui) apps the Carbon framework can come in handy for specific tasks ( cf. How to detect string encoding? on http://www.macosxguru.net/article.php?story=20030808081801868 ).</description>
		<content:encoded><![CDATA[<p>In some (non-gui) apps the Carbon framework can come in handy for specific tasks ( cf. How to detect string encoding? on <a href="http://www.macosxguru.net/article.php?story=20030808081801868" rel="nofollow">http://www.macosxguru.net/article.php?story=20030808081801868</a> ).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noodlings &#187; System Icon Viewer</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-1#comment-14254</link>
		<dc:creator>Noodlings &#187; System Icon Viewer</dc:creator>
		<pubDate>Sun, 10 Sep 2006 16:44:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-14254</guid>
		<description>[...] When I saw this post, I mentioned to Daniel Jalkut that I had done the same thing that he did (which was to create an NSImage category to access Carbon&#8217;s Icon Manager&#8217;s icons). After his obligatory insistence that I start a blog, I sent him a little program I had thrown together to preview the icons. [...]</description>
		<content:encoded><![CDATA[<p>[...] When I saw this post, I mentioned to Daniel Jalkut that I had done the same thing that he did (which was to create an NSImage category to access Carbon&#8217;s Icon Manager&#8217;s icons). After his obligatory insistence that I start a blog, I sent him a little program I had thrown together to preview the icons. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rosyna</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-1#comment-14191</link>
		<dc:creator>Rosyna</dc:creator>
		<pubDate>Sun, 10 Sep 2006 08:17:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-14191</guid>
		<description>Scott Stevenson, and notice how slow Aperture is, especially the 1.0?

The NSWorkspace method is getting the icon for the file that has a create code of &#039;????&#039; (ie, any) and the file type you give it. Your GetIconRef is getting the icons with a creator of kSystemIconsCreator (&#039;macs&#039;), which is a very, very specific domain/application. If you passed &#039;????&#039; to the GetIconRef() function, you&#039;d get the same result. Although you really should use GetIconRefFromTypeInfo(), which is *exactly* what NSWorkspace&#039;s iconForFileType: is doing. However, try drawing the image returned from iconForFileType: in any size than 32x32.</description>
		<content:encoded><![CDATA[<p>Scott Stevenson, and notice how slow Aperture is, especially the 1.0?</p>
<p>The NSWorkspace method is getting the icon for the file that has a create code of &#8216;????&#8217; (ie, any) and the file type you give it. Your GetIconRef is getting the icons with a creator of kSystemIconsCreator (&#8216;macs&#8217;), which is a very, very specific domain/application. If you passed &#8216;????&#8217; to the GetIconRef() function, you&#8217;d get the same result. Although you really should use GetIconRefFromTypeInfo(), which is *exactly* what NSWorkspace&#8217;s iconForFileType: is doing. However, try drawing the image returned from iconForFileType: in any size than 32&#215;32.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Helge</title>
		<link>http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage/comment-page-1#comment-14184</link>
		<dc:creator>Helge</dc:creator>
		<pubDate>Sun, 10 Sep 2006 07:22:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.red-sweater.com/blog/181/the-cocoa-carbon-advantage#comment-14184</guid>
		<description>To those people who don&#039;t believe Carbon applications can look and feel like Cocoa applications: Check out the Nano framework, which is &quot;pure&quot; Carbon:

http://www.refnum.com/products/nano/

Take a look at the example applications. I&#039;m sure almost every Mac user would assume they were Cocoa.</description>
		<content:encoded><![CDATA[<p>To those people who don&#8217;t believe Carbon applications can look and feel like Cocoa applications: Check out the Nano framework, which is &#8220;pure&#8221; Carbon:</p>
<p><a href="http://www.refnum.com/products/nano/" rel="nofollow">http://www.refnum.com/products/nano/</a></p>
<p>Take a look at the example applications. I&#8217;m sure almost every Mac user would assume they were Cocoa.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
