<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Granville Barnett : DSA</title><link>http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx</link><description>Tags: DSA</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>DSA 0.5 released!</title><link>http://weblogs.asp.net/gbarnett/archive/2008/05/30/dsa-0-5-released.aspx</link><pubDate>Fri, 30 May 2008 17:09:50 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6233753</guid><dc:creator>gbarnett</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/gbarnett/rsscomments.aspx?PostID=6233753</wfw:commentRss><comments>http://weblogs.asp.net/gbarnett/archive/2008/05/30/dsa-0-5-released.aspx#comments</comments><description>&lt;p&gt;It's been a while, I've had to work on other stuff for the last 2 or so months which has rendered me with no time. That's the excuses out of the way...&lt;/p&gt;  &lt;p&gt;Not much added in this release I would simply point you to the &lt;a href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=10756"&gt;release page&lt;/a&gt; for more details.&lt;/p&gt;  &lt;p&gt;A friend of mine &lt;a href="http://blogs.ugidotnet.org/wetblog/Default.aspx"&gt;Luca&lt;/a&gt; (&lt;a href="http://translate.google.co.uk/translate?hl=en&amp;amp;sl=it&amp;amp;u=http://blogs.ugidotnet.org/wetblog&amp;amp;sa=X&amp;amp;oi=translate&amp;amp;resnum=1&amp;amp;ct=result&amp;amp;prev=/search%3Fq%3Dluca%2Bdel%2Btongo%26hl%3Den"&gt;translated to english&lt;/a&gt;) has joined the project now and will be helping to shape 0.6 and beyond - welcome Luca!!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=10756"&gt;Download DSA 0.5&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6233753" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/gbarnett/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Data+Structures/default.aspx">Data Structures</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Algorithms/default.aspx">Algorithms</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Open+Source/default.aspx">Open Source</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx">DSA</category></item><item><title>DSA Recap</title><link>http://weblogs.asp.net/gbarnett/archive/2008/05/08/dsa-recap.aspx</link><pubDate>Thu, 08 May 2008 22:42:40 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6171324</guid><dc:creator>gbarnett</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/gbarnett/rsscomments.aspx?PostID=6171324</wfw:commentRss><comments>http://weblogs.asp.net/gbarnett/archive/2008/05/08/dsa-recap.aspx#comments</comments><description>&lt;p&gt;Some of you will no doubt know that I started a project a while ago now that was intent on bringing implementations of various algorithms and data structures to .NET - but with a different take on things.&lt;/p&gt;  &lt;p&gt;Well, after a recent detour with &lt;a href="http://codeplex.com/cpuss"&gt;CPUSS&lt;/a&gt; (a project that analyses CPU scheduling algorithms - interesting project, give it a download!) in less than a week &lt;a href="http://codeplex.com/dsa"&gt;DSA&lt;/a&gt; will receive a lot of time again (next Thursday signals the end of a busy spell of work).&lt;/p&gt;  &lt;p&gt;I wanted to thank the few hundred or so who have downloaded &lt;a href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=9403"&gt;DSA 0.4&lt;/a&gt; - you're participation itself is motivation. I have some news for DSA 0.6 that is interesting but I will save that for when DSA 0.5 is released.&lt;/p&gt;  &lt;p&gt;I am looking for suggestions of things to add to DSA 1.0 (bare in mind that graphs are on the schedule) so if you can think of a pretty rare data structure or algorithm that you think would be nice to implement then please let me know as I can see whether or not (depending on time constraints) I can get it into DSA 1.0.&lt;/p&gt;  &lt;p&gt;The plan is to hopefully release DSA 1.0 by the end of summer (think early September) so I am really expecting things to move quick from a weeks time.&lt;/p&gt;  &lt;p&gt;Thank you to all those who have downloaded, there are some exciting things to come!&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6171324" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Data+Structures/default.aspx">Data Structures</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Algorithms/default.aspx">Algorithms</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx">DSA</category></item><item><title>DSA 0.4 released!</title><link>http://weblogs.asp.net/gbarnett/archive/2008/02/21/dsa-0-4-released.aspx</link><pubDate>Thu, 21 Feb 2008 13:33:50 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5835163</guid><dc:creator>gbarnett</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/gbarnett/rsscomments.aspx?PostID=5835163</wfw:commentRss><comments>http://weblogs.asp.net/gbarnett/archive/2008/02/21/dsa-0-4-released.aspx#comments</comments><description>&lt;p&gt;The latest version of the Data Structures and Algorithms (DSA) library is out!&lt;/p&gt;  &lt;p&gt;&lt;a href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=9403"&gt;Download DSA 0.4&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This latest release contains the following additions:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;QuickSort&amp;lt;T&amp;gt;&lt;/li&gt;    &lt;li&gt;UnorderedSet&amp;lt;T&amp;gt;&lt;/li&gt;    &lt;li&gt;Heap&amp;lt;T&amp;gt;&lt;/li&gt;    &lt;li&gt;ShellSort&amp;lt;T&amp;gt;&lt;/li&gt;    &lt;li&gt;InsertionSort&amp;lt;T&amp;gt;&lt;/li&gt;    &lt;li&gt;RepeatedWordCount&lt;/li&gt;    &lt;li&gt;ToBaseN (Binary, Octal, Hex)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=9403"&gt;Download DSA 0.4&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The documentation has also had a facelift.&lt;/p&gt;  &lt;p&gt;DSA 0.5 features will be finalized in the next few days.&lt;/p&gt;  &lt;p&gt;Thank you to everyone who has downloaded DSA so far and the feedback provided, so far DSA has been received very well by the community and I hope this latest release will build on that.&lt;/p&gt;  &lt;p&gt;For more details on what is in DSA 0.4 please view &lt;a href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=9403"&gt;this&lt;/a&gt; page.&lt;/p&gt;  &lt;p&gt;Thanks&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5835163" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/gbarnett/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Data+Structures/default.aspx">Data Structures</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Algorithms/default.aspx">Algorithms</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Software+Development/default.aspx">Software Development</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Open+Source/default.aspx">Open Source</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx">DSA</category></item><item><title>DSA 0.3 released!</title><link>http://weblogs.asp.net/gbarnett/archive/2007/12/24/dsa-0-3-released.aspx</link><pubDate>Mon, 24 Dec 2007 22:28:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5498040</guid><dc:creator>gbarnett</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/gbarnett/rsscomments.aspx?PostID=5498040</wfw:commentRss><comments>http://weblogs.asp.net/gbarnett/archive/2007/12/24/dsa-0-3-released.aspx#comments</comments><description>&lt;P&gt;Just before Christmas as well :-)&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=7657" mce_href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=7657"&gt;Download DSA 0.3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;New features for this release include:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Probability Search&lt;/LI&gt;
&lt;LI&gt;Power algorithm&lt;/LI&gt;
&lt;LI&gt;Greatest common denominator algorithm&lt;/LI&gt;
&lt;LI&gt;Reverse words algorithm&lt;/LI&gt;
&lt;LI&gt;Set collection (will be renamed to OrderedSet in DSA 0.4 and an unordered Set will be introduced in DSA 0.4 as well)&lt;/LI&gt;
&lt;LI&gt;Sequential search&lt;/LI&gt;
&lt;LI&gt;Merge sort&lt;/LI&gt;
&lt;LI&gt;Merge ordered&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Some other not so major features include:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Pseudo code for around 75% of everything to enable easy language ports (100% of everything will be in DSA 0.4 - the paper to screen conversion is taking a while)&lt;/LI&gt;
&lt;LI&gt;Queue and Stack have been dropped - DSA will only support collections not in the BCL&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;ArrayList is being dropped in DSA 0.4&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Complete XML documentation for every public algorithm/data structure - also private methods are XML doc'd as well.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Also this is the first release to include offline documentation (or documentation of any kind excluding XML docs).&lt;/P&gt;
&lt;P&gt;&lt;A href="http://gbarnett.org/BlogPosts/DSA0.3released_13AF1/DataStructuresandAlgorithmsDocumentation.png" target=_blank mce_href="http://gbarnett.org/BlogPosts/DSA0.3released_13AF1/DataStructuresandAlgorithmsDocumentation.png"&gt;&lt;IMG height=182 alt="Data Structures and Algorithms Documentation" src="http://gbarnett.org/BlogPosts/DSA0.3released_13AF1/DataStructuresandAlgorithmsDocumentation_thumb.png" width=240 border=0 mce_src="http://gbarnett.org/BlogPosts/DSA0.3released_13AF1/DataStructuresandAlgorithmsDocumentation_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=7657" mce_href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=7657"&gt;Download DSA 0.3&lt;/A&gt;&lt;/P&gt;
&lt;H4&gt;DSA 0.4&lt;/H4&gt;
&lt;P&gt;This release will be out mid February and will introduce some new key algorithms and collections.&amp;nbsp; I am in the process of finalizing the features to be added in DSA 0.4 but you can expect more tree data structures as well as balancing algorithms to further optimise tree data structures.&amp;nbsp; I will post something when this is finalized - will be the back end of December.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=7657" mce_href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=dsa&amp;amp;ReleaseId=7657"&gt;Download DSA 0.3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Thank you for your support and if there is anything you would like to suggest then it is not too late...also if you find any issues please let me know.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5498040" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/gbarnett/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Data+Structures/default.aspx">Data Structures</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Algorithms/default.aspx">Algorithms</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Software+Development/default.aspx">Software Development</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx">DSA</category></item><item><title>Profiling some data structures</title><link>http://weblogs.asp.net/gbarnett/archive/2007/10/13/profiling-some-data-structures.aspx</link><pubDate>Sat, 13 Oct 2007 17:27:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4569576</guid><dc:creator>gbarnett</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/gbarnett/rsscomments.aspx?PostID=4569576</wfw:commentRss><comments>http://weblogs.asp.net/gbarnett/archive/2007/10/13/profiling-some-data-structures.aspx#comments</comments><description>&lt;P&gt;I don't know why but I randomly decided to see how well my SinglyLinkedListCollection&amp;lt;T&amp;gt; fared against the LinkedList&amp;lt;T&amp;gt; collection in System.Collections.Generic.&lt;/P&gt;
&lt;P&gt;First off, my implementation supports pretty much everything that the MS LinkedList&amp;lt;T&amp;gt; does, that includes full LINQ support and so on.&lt;/P&gt;
&lt;P&gt;Anyway, I added 5000 items to each to see what that would do - I actually expected the BCL data structure to be superior to mine.&amp;nbsp; I had done no real magic in my implementation, I had simply coded the thing after working out the various algorithms on paper.&lt;/P&gt;
&lt;P&gt;Memory allocation:&amp;nbsp; both data structures are allocated 48 bytes total per instance, however I can only assume that the node used internally by the BCL collection has maybe another pointer i.e. it has a next and prev pointer, giving the ability to use it as a DoublyLinkedList? (I've not looked at it yet).&amp;nbsp; This is where my implementation kind of wins, although I'm pretty sure at this moment that the BCL node supports doubly linked list style structures - in any case as my node is smaller than that of the BCL one my implementation after 5000 instances are created totals 160,000 bytes, the BCL one on the other hand stands at 240,000 bytes so quite a reduction there.&lt;/P&gt;
&lt;P&gt;FYI: my node size is 32 bytes, the BCL one is 48 bytes.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://gbarnett.org/BlogPosts/Perfingsomedatastructures_1035E/sllVll.png" target=_blank atomicselection="true" mce_href="http://gbarnett.org/BlogPosts/Perfingsomedatastructures_1035E/sllVll.png"&gt;&lt;IMG height=151 alt=sllVll src="http://gbarnett.org/BlogPosts/Perfingsomedatastructures_1035E/sllVll_thumb.png" width=240 border=0 mce_src="http://gbarnett.org/BlogPosts/Perfingsomedatastructures_1035E/sllVll_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Out of curiosity I also benchmarked my DoublyLinkedListCollection&amp;lt;T&amp;gt; against the LinkedList&amp;lt;T&amp;gt; of the BCL and my node size is still smaller, this time only by 8 bytes per instance but it still add's up.&amp;nbsp; Same scenario, 5000 items added my implementation has been allocated 200,000 bytes where as the BCL one has been allocated 240,000 bytes - still a considerable saving, all be it slightly less.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://gbarnett.org/BlogPosts/Perfingsomedatastructures_1035E/dllVll.png" target=_blank atomicselection="true" mce_href="http://gbarnett.org/BlogPosts/Perfingsomedatastructures_1035E/dllVll.png"&gt;&lt;IMG height=151 alt=dllVll src="http://gbarnett.org/BlogPosts/Perfingsomedatastructures_1035E/dllVll_thumb.png" width=240 border=0 mce_src="http://gbarnett.org/BlogPosts/Perfingsomedatastructures_1035E/dllVll_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Again, the actual data structures were allocated 48 bytes.&lt;/P&gt;
&lt;P&gt;If you want to rip my implementations to bits then you can go ahead and download it from here: &lt;A href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=7405" mce_href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=7405"&gt;DSA 0.2.2&lt;/A&gt; (you shouldn't notice any difference between these implementations and the BCL ones - both in terms of API and design time debugging experiences).&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4569576" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/gbarnett/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Data+Structures/default.aspx">Data Structures</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Algorithms/default.aspx">Algorithms</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/CLR/default.aspx">CLR</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx">DSA</category></item><item><title>DSA 0.2 released</title><link>http://weblogs.asp.net/gbarnett/archive/2007/09/14/dsa-0-2-released.aspx</link><pubDate>Fri, 14 Sep 2007 21:08:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:3870194</guid><dc:creator>gbarnett</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/gbarnett/rsscomments.aspx?PostID=3870194</wfw:commentRss><comments>http://weblogs.asp.net/gbarnett/archive/2007/09/14/dsa-0-2-released.aspx#comments</comments><description>&lt;P&gt;The &lt;A href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6894" mce_href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6894"&gt;0.2&lt;/A&gt; release of &lt;A href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6894" mce_href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6894"&gt;DSA&lt;/A&gt; has just been released, features for this release include:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;ArrayListCollection(Of T)&lt;/LI&gt;
&lt;LI&gt;DoublyLinkedListCollection(Of T)&lt;/LI&gt;
&lt;LI&gt;SinglyLinkedListCollection(Of T)&lt;/LI&gt;
&lt;LI&gt;StackCollection(Of T)&lt;/LI&gt;
&lt;LI&gt;QueueCollection(Of T)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;There are also a few algorithms that make there debut (very simple ones - time was consumed with the data structures):&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Reverse&lt;/LI&gt;
&lt;LI&gt;Any&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;More algorithms will be in the 0.2.1 release which is a minor release, probably with some bug fixes also :-)&lt;/P&gt;
&lt;P&gt;All data structures are meant to be interacted with&amp;nbsp;exactly (almost!) like those in the BCL, so if you find that something doesn't act the same was as the BCL equivalent then please tell me.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6894" mce_href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6894"&gt;Download DSA 0.2&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=3870194" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/gbarnett/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Data+Structures/default.aspx">Data Structures</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Algorithms/default.aspx">Algorithms</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Software+Development/default.aspx">Software Development</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx">DSA</category></item><item><title>DSA 0.1 released</title><link>http://weblogs.asp.net/gbarnett/archive/2007/09/07/dsa-0-1-released.aspx</link><pubDate>Fri, 07 Sep 2007 10:37:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:3777256</guid><dc:creator>gbarnett</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/gbarnett/rsscomments.aspx?PostID=3777256</wfw:commentRss><comments>http://weblogs.asp.net/gbarnett/archive/2007/09/07/dsa-0-1-released.aspx#comments</comments><description>&lt;P&gt;Today, I pushed the release button on a little project I've been doing over on &lt;A href="http://www.codeplex.com/" mce_href="http://www.codeplex.com/"&gt;CodePlex&lt;/A&gt; entitled &lt;A href="http://www.codeplex.com/dsa" mce_href="http://www.codeplex.com/dsa"&gt;Data Structures and Algorithms (DSA)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The story of the project is to basically go ahead and without looking at the .NET source create custom implementations of some of the stuff in the &lt;A href="http://msdn2.microsoft.com/en-us/library/system.collections.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.collections.aspx"&gt;System.Collections&lt;/A&gt; namespace (as well as some collections that aren't present), as well as providing algorithms for common problems - these will mainly be implemented as extension methods which were introduced in C# 3.0 to give that smooth integration with the .NET stack.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6683" mce_href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6683"&gt;Data Structures and Algorithms (DSA) 0.1&lt;/A&gt;, includes:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;SinglyLinkedListCollection(Of T) 
&lt;LI&gt;QueueCollection(Of T) 
&lt;LI&gt;StackCollection(Of T)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;As well as those data structures, this release has:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;VS debugging integration 
&lt;LI&gt;LINQ support 
&lt;LI&gt;Act like .NET collections (implement all major interfaces) 
&lt;LI&gt;CLS compliant (C# and C++/CLI examples for download) 
&lt;LI&gt;Full FxCop compliance&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Go &lt;A href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6683" mce_href="http://www.codeplex.com/dsa/Release/ProjectReleases.aspx?ReleaseId=6683"&gt;download&lt;/A&gt; it, tell me what you think and where I have gone wrong or right!&amp;nbsp;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=3777256" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/gbarnett/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Data+Structures/default.aspx">Data Structures</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Algorithms/default.aspx">Algorithms</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/C_2B002B002F00_CLI/default.aspx">C++/CLI</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx">DSA</category></item><item><title>Debug proxies for custom collections to aide debugging in Visual Studio</title><link>http://weblogs.asp.net/gbarnett/archive/2007/09/06/debug-proxies-for-custom-collections-to-aide-debugging-in-visual-studio.aspx</link><pubDate>Thu, 06 Sep 2007 10:24:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:3764675</guid><dc:creator>gbarnett</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/gbarnett/rsscomments.aspx?PostID=3764675</wfw:commentRss><comments>http://weblogs.asp.net/gbarnett/archive/2007/09/06/debug-proxies-for-custom-collections-to-aide-debugging-in-visual-studio.aspx#comments</comments><description>&lt;P&gt;I stumbled across this while working on a small project (&lt;A href="http://www.codeplex.com/dsa" mce_href="http://www.codeplex.com/dsa"&gt;Data Structures and Algorithms (DSA)&lt;/A&gt;).&amp;nbsp; Creating a proxy for a type, or whatever really - in my case a collection is really simple and provides some really cool results in the locals window when debugging.&lt;/P&gt;
&lt;H4&gt;Raw View&lt;/H4&gt;
&lt;P&gt;The raw view is exactly what it implies, a no holds barred view of of type you are displaying in the locals window.&amp;nbsp; The raw view by default is not expanded, instead you have a small amount of information about a particular object.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://gbarnett.org/BlogPosts/Debugproxiesforcustomcollectionstoaidede_FE9A/vis1_3.png" target=_blank mce_href="http://gbarnett.org/BlogPosts/Debugproxiesforcustomcollectionstoaidede_FE9A/vis1_3.png" atomicselection="true"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=95 alt=vis1 src="http://gbarnett.org/BlogPosts/Debugproxiesforcustomcollectionstoaidede_FE9A/vis1_thumb_3.png" width=240 border=0 mce_src="http://gbarnett.org/BlogPosts/Debugproxiesforcustomcollectionstoaidede_FE9A/vis1_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;H4&gt;Building a Customized View&lt;/H4&gt;
&lt;P&gt;This is really simple, especially for my scenario.&amp;nbsp; In the previous image you saw that Raw View was a child node of the myQueue node.&amp;nbsp; The direct children of myQueue shows a simplified view of the collection in hand, i.e. it shows it's items in what appears to be an array based format - that is that it starts at 0 and goes from there.&amp;nbsp; This is in fact an array.&lt;/P&gt;
&lt;P&gt;The following is the type used for the proxy (this is actually the same as used for the collection in the BCL):&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="COLOR: #0000ff"&gt;using&lt;/SPAN&gt; System;
&lt;SPAN style="COLOR: #0000ff"&gt;using&lt;/SPAN&gt; System.Collections.Generic;
&lt;SPAN style="COLOR: #0000ff"&gt;using&lt;/SPAN&gt; System.Diagnostics;

&lt;SPAN style="COLOR: #0000ff"&gt;namespace&lt;/SPAN&gt; Dsa {

    &lt;SPAN style="COLOR: #0000ff"&gt;internal&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;sealed&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;class&lt;/SPAN&gt; CollectionDebugView&amp;lt;T&amp;gt; {

        &lt;SPAN style="COLOR: #0000ff"&gt;private&lt;/SPAN&gt; ICollection&amp;lt;T&amp;gt; _collection;

        &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; CollectionDebugView(ICollection&amp;lt;T&amp;gt; collection) {
            &lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt; (collection == &lt;SPAN style="COLOR: #0000ff"&gt;null&lt;/SPAN&gt;) {
                &lt;SPAN style="COLOR: #0000ff"&gt;throw&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; ArgumentNullException("&lt;SPAN style="COLOR: #8b0000"&gt;collection&lt;/SPAN&gt;");
            }
            _collection = collection;
        }

        [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
        &lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt; T[] Items {
            &lt;SPAN style="COLOR: #0000ff"&gt;get&lt;/SPAN&gt; {
                T[] items = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; T[_collection.Count];
                _collection.CopyTo(items, 0);
                &lt;SPAN style="COLOR: #0000ff"&gt;return&lt;/SPAN&gt; items;
            }
        }

    }

}&lt;/PRE&gt;
&lt;P&gt;This debug proxy is designed to work on any collection that implements the ICollection(Of T) interface.&amp;nbsp; The array like representation of the items in the collection I spoke about earlier are retrieved from the public property Items.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Note:&amp;nbsp; any public properties that have getters will be visible in the locals window.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;There are a few final steps that you need to go ahead and do if you want to provide this rich debug experience for your customers and that lies within the use of a few attributes.&lt;/P&gt;&lt;PRE&gt;[DebuggerDisplay("&lt;SPAN style="COLOR: #8b0000"&gt;Count={Count}&lt;/SPAN&gt;")]
[DebuggerTypeProxy(&lt;SPAN style="COLOR: #0000ff"&gt;typeof&lt;/SPAN&gt;(CollectionDebugView&amp;lt;&amp;gt;))]&lt;/PRE&gt;
&lt;P&gt;The first attribute is what makes the count of the items appear level with the collection object name, Count is a property that is a member of the ICollection(Of T) interface.&lt;/P&gt;
&lt;P&gt;The second DebuggerTypeProxyAttribute is what utilizes our debug proxy - when you expand the custom collection node we use the proxy to define what should be shown initially to the developer, the Raw View becomes a child of that simplified view.&amp;nbsp; The type of the CollectionDebugView type is, like all generics determined at run time (unlike C++ which is compile time) - as we can't explicitly say what type the user will be creating a collection of we use the empty &amp;lt;&amp;gt;.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=3764675" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/gbarnett/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Data+Structures/default.aspx">Data Structures</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/gbarnett/archive/tags/DSA/default.aspx">DSA</category></item></channel></rss>