<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scientific Ninja &#187; Josh Petrie</title>
	<atom:link href="http://scientificninja.com/author/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://scientificninja.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Jul 2010 02:58:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Dotfiles and Dropbox</title>
		<link>http://scientificninja.com/blog/dotfiles-and-dropbox</link>
		<comments>http://scientificninja.com/blog/dotfiles-and-dropbox#comments</comments>
		<pubDate>Thu, 15 Jul 2010 04:26:01 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=964</guid>
		<description><![CDATA[I am generally not a fan of extensively customizing my tools or work environment. If the benefit isn&#8217;t significant, I&#8217;m not going to spend my time monkeying around with settings and configuration files and screens of options: they get in the way of actually being productive. vim is one of those tools that&#8217;s so useful [...]]]></description>
			<content:encoded><![CDATA[<p>I am generally not a fan of extensively customizing my tools or work environment. If the benefit isn&#8217;t significant, I&#8217;m not going to spend my time monkeying around with settings and configuration files and screens of options: they get in the way of actually being productive. <a href="http://www.vim.org/">vim</a> is one of those tools that&#8217;s so useful to my workflow that a bespoke configuration is worth the effort &#8212; but only if I can make that configuration as trivially ubiquitous as vim itself.</p>

<p>Up until recently I&#8217;d used <a href="http://subversion.tigris.org/">Subversion</a> to store all my vim (and other) configuration files. This is a <a href="http://technotales.wordpress.com/2007/02/21/dotfiles-best-practice/">reasonably</a> <a href="http://joey.kitenet.net/svnhome/">common</a> <a href="http://stackoverflow.com/questions/169574/keeping-dot-files-synched-across-machines">practice</a>. But I&#8217;ve had two issues with this approach. First, I had a few makefiles (or batch files for Windows) that I used to sync the contents of the repository to to appropriate locations on each type of machine. I did this largely to keep my home directories clean, but having to maintain them &#8212; even in a limited capacity &#8212; was obnoxious. Second, I had to remember to actually commit any changes I made back to the central repository. On a number of occasions I made some tweak at work, went home, and realized I&#8217;d failed to commit. A minor annoyance, but an annoyance nonetheless.</p>

<p>This is why I decided to try storing the configuration using <a href="https://www.dropbox.com/home">Dropbox</a>. Since Dropbox storage is accessible like a local directory, I could easily create symbolic links to the .vimrc file and .vim directories stored in my Dropbox drive on all my machines. This means I don&#8217;t have to manually commit any local changes back to the repository. It also obviates the need for the synchronization makefiles; while they provided a bit of a buffer for changes, which was occasionally nice, they existed largely to keep the temporary cruft created by a Subversion working copy out of my home directories. That&#8217;s not a problem with Dropbox.</p>

<p>So far I&#8217;ve had no trouble using this approach, and the additional streamlining is a huge boon. I was very pleased, in particular, that the symlinks worked out so well. My fallback was to create shim .vimrcs that set $VIMRUNTIME and sourced the Dropbox version of the file, but fortunately I didn&#8217;t need to.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/dotfiles-and-dropbox/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SlimDX June 2010 Released</title>
		<link>http://scientificninja.com/blog/slimdx-june-2010-released</link>
		<comments>http://scientificninja.com/blog/slimdx-june-2010-released#comments</comments>
		<pubDate>Mon, 05 Jul 2010 16:05:47 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[slimdx]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=959</guid>
		<description><![CDATA[Actually it was released last week, when it still was actually June, so I&#8217;m a little late to this party. Mike did the official release thread on GDNet this time around in which he calls out the major changes, including .NET 4.0 support, cleaner access to the shader compiler interfaces, and a much more robust [...]]]></description>
			<content:encoded><![CDATA[<p>Actually it was released last week, when it still was actually June, so I&#8217;m a little late to this party. Mike did <a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=575638">the official release thread</a> on GDNet this time around in which he calls out the major changes, including .NET 4.0 support, cleaner access to the shader compiler interfaces, and a much more robust DirectWrite implementation.</p>

<p>Also, in an effort to try and get a better sense of our users and community, we&#8217;ve put together this quick <a href="http://www.surveymonkey.com/s/6LW9QXG">SlimDX developer survey</a> and would appreciate your time in filling it out if you use, have used, or are considering using SlimDX for anything.</p>

<p>Finally, we&#8217;ve received several queries through various channels about contributing to SlimDX, especially the upcoming version 2.0 redesign. If you are at all interested in participating in or simply observing the discussions about the redesign, you should join the <a href="http://groups.google.com/group/slimdx-devel">slimdx-devel</a> mailing list.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/slimdx-june-2010-released/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Canlis</title>
		<link>http://scientificninja.com/blog/canlis</link>
		<comments>http://scientificninja.com/blog/canlis#comments</comments>
		<pubDate>Fri, 07 May 2010 00:45:21 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[food]]></category>
		<category><![CDATA[restaurant]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=933</guid>
		<description><![CDATA[Canlis is a restaurant in Seattle&#8217;s Queen Anne neighborhood, overlooking Lake Union. The restaurant has been operating since 1950, when it was opened by Peter Canlis, and is run today by Mark and Brian Canlis, Peter&#8217;s grandchildren. Since its inception, Canlis has maintained a reputation of being among the fanciest restaurants in the area, as [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.canlis.com/">Canlis</a> is a restaurant in Seattle&#8217;s Queen Anne neighborhood, overlooking Lake Union. The restaurant has been operating since 1950, when it was opened by Peter Canlis, and is run today by Mark and Brian Canlis, Peter&#8217;s grandchildren. Since its inception, Canlis has maintained a reputation of being among the fanciest restaurants in the area, as well as having exceptional food, presentation and service. Last Thursday I was able to check out this hallmark of the Seattle food scene with my friend and dance partner, Katie Clark. She had rather inflated my expectations of the restaurant by gushing positively about it in the hours leading up to our dinner reservation &#8212; but even then, I was impressed by the experience.</p>

<p>We arrived, all dressed up, shortly before our 8PM reservation. The valet took my car without giving me a ticket &#8212; one of the things the staff is known for is their ability to operate their valet service smoothly without such pedestrian aides as <em>tickets</em> &#8212; and we were promptly shown to our table. We were seated on the opposite side of the dining room from the main windows, and there was another party at a table between us and the view. However, the windows were large enough that we still were able to see out across Lake Union, and we were near the kitchen (which I always enjoy).</p>

<p>We were there for the three-course dinner offered as part of the <a href="http://seattlest.com/2010/04/16/seattle_restaurant_week_starts_sund.php">Seattle Restaurant Week</a> promotion, and since there were two of us and two options for each course we were able to experience everything on the menu. I carelessly left my phone in my car, so credit for all of these wonderful photos must go to the lovely Ms. Clark:
<center>
<a href="http://www.flickr.com/photos/jpetrie/4832910340/" title="Canlis Salad by jpetrie, on Flickr"><img src="http://farm5.static.flickr.com/4133/4832910340_b869b10739_m.jpg" width="240" height="180" alt="Canlis Salad" /></a>
<a href="http://www.flickr.com/photos/jpetrie/4832910834/" title="Lamb and Tagliatelle by jpetrie, on Flickr"><img src="http://farm5.static.flickr.com/4125/4832910834_e9c3b1193f_m.jpg" width="240" height="180" alt="Lamb and Tagliatelle" /></a>
<a href="http://www.flickr.com/photos/jpetrie/4832910100/" title="Soup by jpetrie, on Flickr"><img src="http://farm5.static.flickr.com/4153/4832910100_aa16648c5e_m.jpg" width="180" height="240" alt="Soup" /></a>
<a href="http://www.flickr.com/photos/jpetrie/4832910600/" title="Seared Halibut by jpetrie, on Flickr"><img src="http://farm5.static.flickr.com/4109/4832910600_0a7bb9c4a5_m.jpg" width="180" height="240" alt="Seared Halibut" /></a>
<a href="http://www.flickr.com/photos/jpetrie/4832302227/" title="Shortcake by jpetrie, on Flickr"><img src="http://farm5.static.flickr.com/4127/4832302227_051f992f93_m.jpg" width="240" height="180" alt="Shortcake" /></a>
<a href="http://www.flickr.com/photos/jpetrie/4832911114/" title="Creme brulée by jpetrie, on Flickr"><img src="http://farm5.static.flickr.com/4088/4832911114_56a6352c22_m.jpg" width="240" height="180" alt="Creme brulée" /></a>
</center></p>

<p>A wine pairing was offered to accompany each dish; we both ordered it, but since I have a terrible memory for wine I couldn&#8217;t really tell you much about it. All of it was awesome, though, especially the dessert wine &#8212; which isn&#8217;t something I normally enjoy. The service was excellent, and the staff was attentive and responsive, very knowledgeable about the food and preparation. We only had to suffer through one minor delay, just before placing our order, but given how busy the dining room was that evening I was not terribly bothered and our server&#8217;s affable mood more than made up for it.</p>

<p>In addition to the items on the menu, we were served a small cup of gazpacho as an amuse bouche and pair of wonderful petit fours along with the coffee we had after dessert. Once the meal was concluded, our server took us on a quick tour of the restaurant, showing us the various private dining rooms that were not currently in use, and offering a lot of interesting information about the history of the Canlis family and the restaurant itself. At the conclusion of the tour, somebody was waiting with Katie&#8217;s coat and my car was ready outside. Impressive.</p>

<p>Despite the upscale dress code, ironed tablecloths, and general air of &#8220;fancy,&#8221; the atmosphere of the restaurant wasn&#8217;t stuffy &#8212; they take your dining experience seriously, but not so seriously as to make you worry about stepping out of line. You can get an idea of the attitude of the place by taking a look at the light humor on their <a href="http://www.canlis.com/about/qa.aspx">Q&amp;A page</a>.</p>

<p>I will definitely make the time to go again.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/canlis/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C Strings Are Evil</title>
		<link>http://scientificninja.com/blog/c-strings-are-evil</link>
		<comments>http://scientificninja.com/blog/c-strings-are-evil#comments</comments>
		<pubDate>Wed, 28 Apr 2010 15:08:18 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[for-beginners]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=924</guid>
		<description><![CDATA[GDNet community manager Washu has written about the perils of C-style strings for beginners (in C++). In his post, he covered a variety of excellent points, but he missed one of my favorites: C-style strings are not a type. A C-style string is just an interpretation of an actual type (a char*) that adds some [...]]]></description>
			<content:encoded><![CDATA[<p>GDNet community manager Washu <a href="http://scapecode.com/2010/04/is-it-really-a-bug-for-a-beginner-to-be-using-c-string-in-c/">has written about the perils of C-style strings for beginners</a> (in C++). In his post, he covered a variety of excellent points, but he missed one of my favorites: <em>C-style strings are not a type</em>.</p>

<p>A C-style string is just an interpretation of an actual type (a char*) that adds some additional semantics. These semantics are not enforced by the language, except implicitly and very poorly via some C library functions. This approach, which presumably grew out of the &#8220;pay for what you use&#8221; mentality, is a huge part of what makes C-style strings cumbersome and error-prone.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/c-strings-are-evil/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thoughts on SlimDX 2: Object Lifetime</title>
		<link>http://scientificninja.com/blog/thoughts-on-slimdx-2-object-lifetime</link>
		<comments>http://scientificninja.com/blog/thoughts-on-slimdx-2-object-lifetime#comments</comments>
		<pubDate>Wed, 31 Mar 2010 02:14:32 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[com]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[slimdx]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=866</guid>
		<description><![CDATA[This will likely be my last post on the subject of the major changes coming in SlimDX 2 for a little while. My last few posts have focused on issues we&#8217;re fairly certain will be relevant to the new API (as will this post) &#8212; but we don&#8217;t have everything planned out yet. We have [...]]]></description>
			<content:encoded><![CDATA[<p>This will likely be my last post on the subject of the major changes coming in SlimDX 2 for a little while. My last <a href="http://scientificninja.com/blog/thoughts-on-slimdx-2-interfaces">few</a> <a href="http://scientificninja.com/blog/thoughts-on-slimdx-2-assembly-design">posts</a> have focused on issues we&#8217;re fairly certain will be relevant to the new API (as will this post) &#8212; but we don&#8217;t have <em>everything</em> planned out yet. We have a few ideas we&#8217;d like to experiment with, but we&#8217;re going to have to take some time to prototype them and mess around before we can commit to any one solution. Indeed, there are even a few unanswered questions about the topic I&#8217;m going to talk about today.</p>

<p>That topic is how we&#8217;re not going to use IDisposable any longer.</p>

<p>More specifically, we&#8217;re not going to use it <em>as much</em>. Almost every SlimDX 1 object implements IDisposable, because IDisposable is all about cleaning up unmanaged resources and SlimDX objects are, for the most part, exactly that. But the sort of resources IDisposable is geared towards are those with very explicit lifetimes: you create it, do your thing, and then Dispose() of it. C# using-blocks allow you to implement this exact pattern for locally-held objects quite efficiently.</p>

<p>Long-time readers will recall that our IDisposable wrappers around COM objects have caused us a lot of trouble in the past, largely because the interface&#8217;s contract does not really jive with COM&#8217;s reference counting. To account for this, we implemented an object table based loosely on the same principles that the <a href="http://msdn.microsoft.com/en-us/library/8bwh56xe.aspx">.NET RCW</a> uses &#8212; specifically, we tried to maintain exactly one COM reference to any object known to SlimDX so that we could do the correct thing when Dispose() was called. This eventually led us to an overly-complicated system burdened with multiple creation code paths and inconsistent ownership semantics.</p>

<p>Our solution is to, essentially, side-step the issue entirely and just expose the reference counting directly. All SlimDX 2 objects that are backed by actual COM interfaces implement IComObject, which provides the familiar-looking methods AddReference() and Release(). For the trivial scenarios where you just want quick, scoped access to a COM object, we&#8217;ll be providing a simple IDisposable utility wrapper you can use in conjunction with a using-block to automatically drop the reference count when appropriate.</p>

<p>While it first might seem like this change is a step <em>backwards</em>, we think that it&#8217;s an improvement in the long run: it obviates the need for the exceedingly complex object ownership rules that existed with SlimDX 1 (which, we suspect, most of our users were getting wrong). Plus, it makes the SlimDX ownership semantics match those of the already-familiar native API.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/thoughts-on-slimdx-2-object-lifetime/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ada Lovelace Day 2010: Tess Ferrandez</title>
		<link>http://scientificninja.com/blog/ada-lovelace-day-2010-tess-ferrandez</link>
		<comments>http://scientificninja.com/blog/ada-lovelace-day-2010-tess-ferrandez#comments</comments>
		<pubDate>Wed, 24 Mar 2010 16:30:21 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[industry]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=869</guid>
		<description><![CDATA[Today is March 24th: Ada Lovelace Day. I first heard about this event last year, via a co-worker&#8217;s blog, but it was too late at the time for me to come up with a contribution myself. As it stands, I almost missed this year, too! In any event, the purpose of Ada Lovelace Day is [...]]]></description>
			<content:encoded><![CDATA[<p>Today is March 24th: <a href="http://findingada.com/about/">Ada Lovelace Day</a>. I first heard about this event last year, via a <a href="http://www.acidforblood.net/2009/03/ada-lovelace-day-spotlight-on-paulina-bozek.html">co-worker&#8217;s blog</a>, but it was too late at the time for me to come up with a contribution myself. As it stands, I almost missed this year, too!</p>

<p>In any event, the purpose of Ada Lovelace Day is to write a post celebrating the achievements of women (or a particular woman) in the technology industry and thus, I would like to call out <a href="http://blogs.msdn.com/Tess/">Tess Ferrandez</a>, ASP.NET escalation engineer extraordinaire.</p>

<p>But this post isn&#8217;t about Ferrandez&#8217;s achievements in the domain of ASP.NET, specifically. Instead, this is about commending her for her work in educating the development community about debugging in the .NET environment. Ferrandez has been at Microsoft for more than a decade, working with .NET technology since it was in alpha, and offering her knowledge to the community at large through <a href="http://blogs.msdn.com/tess/archive/tags/Debugging/default.aspx">blog posts</a>, <a href="http://www.hanselminutes.com/default.aspx?showID=204">podcasts</a>, <a href="http://channel9.msdn.com/posts/Glucose/Hanselminutes-on-9-Debugging-Crash-Dumps-with-Tess-Ferrandez-and-VS2010/">interviews</a> and by <a href="http://www.msteched.com/europe/Public/FeaturedSpeakers.aspx">speaking at conferences</a>. She often discusses techniques for diagnosing obscure bugs or memory issues, providing great insight into the tools used or the systems affected &#8212; and she&#8217;s always informative, easy to follow, and extremely helpful.</p>

<p>I, personally, can attribute the entirety of my understanding of <a href="http://en.wikipedia.org/wiki/WinDbg">WinDbg</a> and <a href="http://msdn.microsoft.com/en-us/library/bb190764%28VS.80%29.aspx">SOS</a> <em>directly</em> to her, as well as a good portion of my understanding of the .NET internals. I am certainly not the only developer to have benefited from her work. So I want to congratulate you, Tess Ferrandez, on what I feel is the greatest achievement of all: teaching others through your own wisdom and experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/ada-lovelace-day-2010-tess-ferrandez/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hargreaves on Breaking Changes</title>
		<link>http://scientificninja.com/blog/hargreaves-on-breaking-changes</link>
		<comments>http://scientificninja.com/blog/hargreaves-on-breaking-changes#comments</comments>
		<pubDate>Wed, 17 Mar 2010 05:19:02 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[slimdx]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=852</guid>
		<description><![CDATA[Shawn Hargreaves has been writing about the upcoming changes in XNA 4.0 (interesting stuff). The topic is obviously one that resonates with me given my own recent posts. I particularly enjoyed this post. Back in 2007, when SlimDX was a young API, we had the luxury of having very few serious users. When we realized [...]]]></description>
			<content:encoded><![CDATA[<p>Shawn Hargreaves has been writing about <a href="http://blogs.msdn.com/shawnhar/archive/2010/03/16/breaking-changes-in-xna-game-studio-4-0.aspx">the upcoming changes in XNA 4.0</a> (interesting stuff). The topic is obviously one that resonates with me given <a href="http://scientificninja.com/blog/thoughts-on-slimdx-2">my own</a> <a href="http://scientificninja.com/blog/thoughts-on-slimdx-2-interfaces">recent</a> <a href="http://scientificninja.com/blog/thoughts-on-slimdx-2-assembly-design">posts</a>.</p>

<p><a href="http://blogs.msdn.com/shawnhar/archive/2010/03/05/backward-compatibility.aspx">I particularly enjoyed this post</a>. Back in 2007, when SlimDX was a young API, we had the luxury of having very few serious users. When we realized we&#8217;d screwed something up, we just changed it, and it didn&#8217;t matter how much that change would impact a client code. There were no clients.</p>

<p>But now, three years later, that&#8217;s no longer the case. We have quite a few users; SlimDX has been used in commercially released <a href="http://www.arcengames.com/aiwar_features.php">games</a> and <a href="http://www.ventuz.com/">applications</a>, and helps power internal content production tools used by professional studios like <a href="http://zipperint.com/">Zipper Interactive</a>. We no longer have the luxury of implementing sweeping changes on a whim, no matter how correct they may be. We have practical realities to consider: providing sufficient advance warning and documentation. Developing upgrade paths. Transitioning deprecated versions of the API to &#8220;support mode&#8221; for an appropriate period of time.</p>

<p>I believe that breaking changes are for the best when they actually improve the overall health of the API. But they&#8217;re also pretty scary.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/hargreaves-on-breaking-changes/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thoughts on SlimDX 2: Assembly Design</title>
		<link>http://scientificninja.com/blog/thoughts-on-slimdx-2-assembly-design</link>
		<comments>http://scientificninja.com/blog/thoughts-on-slimdx-2-assembly-design#comments</comments>
		<pubDate>Sun, 14 Mar 2010 18:12:53 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[c++/cli]]></category>
		<category><![CDATA[clr]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[slimdx]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=834</guid>
		<description><![CDATA[SlimDX 1 is contained in a single, monolithic C++/CLI assembly. SlimDX 2 is structured differently: it is split up into both public and private DLLs. The public DLL, which will be directly referenced by client code, is written in C# and contains the definitions for all the interfaces, enumerations, et cetera. The private DLL, written [...]]]></description>
			<content:encoded><![CDATA[<p>SlimDX 1 is contained in a single, monolithic C++/CLI assembly. SlimDX 2 is structured differently: it is split up into both public and private DLLs. The public DLL, which will be directly referenced by client code, is written in C# and contains the definitions for all the interfaces, enumerations, et cetera. The private DLL, written in C++/CLI, contains the interface implementations and all our internal machinery.</p>

<p>The primary motivation for organizing the library in this fashion was to eliminate the problems with building “Any CPU” applications using SlimDX.</p>

<p>Managed applications built in “Any CPU” mode are essentially asking the CLR to load them as processes most-appropriate to the host machine: if you’re running on the x64 architecture, you get a 64-bit process. On x86, you&#8217;d get a 32-bit process.</p>

<p>For native code, however, the target architecture needs to be decided at compile-time, which is why there are distinct 32-bit and 64-bit versions of the SlimDX assembly. Unfortunately, <a href="http://blogs.msdn.com/oldnewthing/archive/2008/10/20/9006720.aspx">you cannot load a 32-bit DLL into a 64-bit process</a>.</p>

<p>If you’re using the copies of SlimDX that our installer places in the GAC, you can avoid running afoul of this problem by editing your <code>.csproj</code>. If you’re a user who prefers to reference the SlimDX DLLs themselves, you are out of luck. You have to pick a specific version to reference, and you have to set the machine type of your project to match.</p>

<p>By using a two-part distribution, we can ship a public assembly configured for “Any CPU” use. This assembly can detect whether 32- or 64-bit code would be more appropriate and load the correct private implementation DLL into your process.</p>

<p>This approach also allows us to write more of SlimDX in C#, which is far more pleasant language to work with than C++/CLI, and has a much better toolchain.</p>

<p>It also lets us improve the health of the code we do need to write in C++/CLI. Because of a peculiarity in how templates (not generics) interact with managed types, the presence of a template type anywhere in a class hierarchy results in a complete lack of IntelliSense support for that class hierarchy&#8230; but there’s a lot of redundant boilerplate code in SlimDX, exactly the kind of code one would like to use templates to write just once. We had to compromise and use macros to provide that code for SlimDX 1.</p>

<p>However, with the split-assembly approach &#8212; along with with our adoption of interfaces &#8212; the classes “polluted” by templates exist entirely in the private assembly and are never exposed by their concrete types; the lack of IntelliSense becomes a non-issue.</p>

<p>There is one small downside, unfortunately. Since the implementation DLL is loaded manually, clients who reference and ship private copies of SlimDX (that is, anyone not using the GAC version) will need to add or link the SlimDX implementation DLLs (and PDBs) in their <code>.csproj</code> files in order to allow the build system to copy those files into the directory of the built application.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/thoughts-on-slimdx-2-assembly-design/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Thoughts on SlimDX 2: Interfaces</title>
		<link>http://scientificninja.com/blog/thoughts-on-slimdx-2-interfaces</link>
		<comments>http://scientificninja.com/blog/thoughts-on-slimdx-2-interfaces#comments</comments>
		<pubDate>Sun, 07 Mar 2010 05:32:43 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[slimdx]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=824</guid>
		<description><![CDATA[One of the biggest changes we&#8217;re going to make in SlimDX 2 concerns our use of interface types (specifically, our lack thereof). In the current version of SlimDX, the API consists almost entirely of concrete classes. However, there are advantages to exposing interfaces instead &#8212; improved testability of the public API and code depending on [...]]]></description>
			<content:encoded><![CDATA[<p>One of the biggest changes we&#8217;re going to make in SlimDX 2 concerns our use of interface types (specifically, our lack thereof). In the current version of SlimDX, the API consists almost entirely of concrete classes. However, there are advantages to exposing interfaces instead &#8212; improved testability of the public API and code depending on it, for example, as well as the potential for some back-end improvements to code health. There are two major main concerns involved in redesigning SlimDX to use interfaces:</p>

<p>The first is the question of how one initially obtains an interface. SlimDX 1 uses the constructors of its concrete objects to enable users to obtain new instances. Thus, in SlimDX 1 you would obtain a texture instance by doing new Texture2D( device, &#8230; ). This constructor will invoke the native ID3D10Device::CreateTexture(). In SlimDX 2, we&#8217;ll present a model that mirrors the native interface more closely, with an IDevice interface that demands a CreateTexture method.</p>

<p>To handle bootstrapping &#8212; obtaining that first interface &#8212; we&#8217;ll expose so-called &#8220;API objects&#8221; that will represent each of the primary subsystems SlimDX exposes to native code (for example, there will be a Direct3D10Api object that will let you obtain the initial D3D10 device interface. These API objects will also be a convenient location to present many of the native free functions. SlimDX doesn&#8217;t expose all of these now, and the ones it does provide are often tucked away, seldom-seen static members of one class or another.</p>

<p>The other half of the problem is translating those interfaces back into concrete, usable objects when they are passed back to SlimDX for one reason or another.</p>

<p>We <em>could</em> simply downcast the interface to the concrete type, but that relies on the assumption that such a cast would always succeed &#8212; and that isn&#8217;t true in general. SlimDX has always supported interoperation with other DirectX-wrapping managed libraries, and to make the assumption that our interfaces were only ever implemented by our own library would work against that.</p>

<p>Fortunately, as a result of that interoperability feature, we&#8217;ve had to have all of our objects expose their IUnknown or similar native pointer (wrapped up in a System.IntPtr). Thus, we can rely on an accessor for that pointer being available from the interfaces, and we can use that to obtain the actual interface we&#8217;re interested in working with in the SlimDX code.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/thoughts-on-slimdx-2-interfaces/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thoughts on SlimDX 2</title>
		<link>http://scientificninja.com/blog/thoughts-on-slimdx-2</link>
		<comments>http://scientificninja.com/blog/thoughts-on-slimdx-2#comments</comments>
		<pubDate>Thu, 04 Mar 2010 02:30:43 +0000</pubDate>
		<dc:creator>Josh Petrie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[refactoring]]></category>
		<category><![CDATA[slimdx]]></category>

		<guid isPermaLink="false">http://scientificninja.com/?p=735</guid>
		<description><![CDATA[SlimDX is has become a pretty comprehensive API, but the fact still remains that it is a version-one iteration of the product, and like all version-one iterations, it has issues. In particular, some of the more insidious bugs and poorly-considered design decisions are starting to become increasingly more uncomfortable to deal with. Since no good [...]]]></description>
			<content:encoded><![CDATA[<p>SlimDX is has become a pretty comprehensive API, but the fact still remains that it is a version-one iteration of the product, and like all version-one iterations, it has issues. In particular, some of the more insidious bugs and poorly-considered design decisions are starting to become increasingly more uncomfortable to deal with. Since no good solutions exist for some of these problems that will preserve the existing public interface, we&#8217;ve been thinking about what a version-two iteration of SlimDX will look like. There are quite a few aspects of the API we&#8217;d like to improve for the next version, and over the next few days I&#8217;m going to talk about some of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://scientificninja.com/blog/thoughts-on-slimdx-2/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
