Sign In
BCL Team Blog
Base types, Collections, Diagnostics, IO, RegEx...
Search
Advanced search options...
Search In:
Everything
Blogs
Forums
People
Groups
Places
Pages
Date range:
All Time
Last Year
Last 6 Months
Last 3 Months
Last Month
Last Week
Last Two Days
Tags
.NET Framework 3.5
.NET Framework 4
.NET Framework 4.5 Preview
API
BCL Refresher
CodeDom
compress
Contracts
datatype
Generics
Globalization
managed
MEF
News
parsing
RegEx
Service
Silverlight
System.Collections
System.Diagnostics
System.IO
System.Resources
System.Threading
Win32
ZIP
Options
Blog Home
About
Share this
RSS for posts
Atom
RSS for comments
Translate This Page
Translate this page
Powered by
Microsoft® Translator
Archive
Archives
December 2011
(2)
November 2011
(4)
October 2011
(2)
June 2011
(1)
May 2011
(2)
April 2011
(2)
March 2011
(1)
January 2011
(1)
November 2010
(1)
October 2010
(1)
August 2010
(1)
July 2010
(1)
June 2010
(2)
May 2010
(1)
April 2010
(1)
March 2010
(1)
January 2010
(1)
November 2009
(1)
October 2009
(1)
August 2009
(1)
July 2009
(2)
June 2009
(1)
May 2009
(1)
February 2009
(3)
January 2009
(1)
November 2008
(2)
October 2008
(2)
July 2008
(1)
June 2008
(3)
May 2008
(1)
April 2008
(1)
January 2008
(1)
November 2007
(4)
October 2007
(2)
August 2007
(3)
July 2007
(3)
June 2007
(7)
May 2007
(5)
April 2007
(4)
March 2007
(2)
February 2007
(1)
January 2007
(2)
December 2006
(1)
November 2006
(2)
October 2006
(8)
September 2006
(2)
August 2006
(3)
July 2006
(7)
June 2006
(5)
May 2006
(11)
April 2006
(16)
March 2006
(1)
January 2006
(1)
October 2005
(6)
September 2005
(5)
August 2005
(3)
July 2005
(2)
June 2005
(5)
April 2005
(3)
March 2005
(41)
February 2005
(7)
January 2005
(4)
December 2004
(8)
November 2004
(14)
October 2004
(9)
September 2004
(6)
August 2004
(6)
July 2004
(1)
June 2004
(2)
May 2004
(3)
March 2004
(2)
January 2004
(15)
December 2003
(3)
November 2003
(9)
October 2003
(5)
What's under the hood? [Ariel Weinstein]
MSDN Blogs
>
BCL Team Blog
>
What's under the hood? [Ariel Weinstein]
What's under the hood? [Ariel Weinstein]
BCL Team
5 Aug 2005 11:51 AM
Comments
7
Well, I tried to solicit email from you with any cool ideas you have for Collections, ServiceProcesses, and Diagnostics, but that front has been a bit quiet. Thats quite ok though, because there is something else I would like to touch on today. My main roles right now are those three features, as well as application compatibility between different versions of .Net. Luckily, an issue came up this week that covered both areas very nicely.
I received an email where somebody was trying to understand exactly how
ListDictionary
works. Specifically, ListDictionary is implemented with a list, and the person wanted to know if objects are placed in the front or rear of the list. After talking with other members of the development team, we decided the answer is that it isn't really useful to document how it is implemented. The reason behind it is that people may start using this information to write code that uses behavior that currently works but is not guaranteed to work (you wouldn't do that though, right?).
For example, somebody might want to test if a key was added to the dictionary. If that person knew that the key was placed at the front of the list, they do something very unwise such as checking the first object in the ICollection returned by ListDictionary.Keys to make sure the last Key was entered. This operation _may_ work if the implementation is done in a certain way, but has little to do fundamentally with how a dictionary is intended to work, which means it could be changed in a later version of the software if the current implementation turns out to be broken/slow/whatever.
So to sum up? If you are trying to figure out how something such as a collection is implemented under the covers, it may be appropriate to try using a different collection altogether. For the question above, it may be much better for the user to simply use a List to ensure that functionality.
However, if you think the documentation is sparse, please send drop a comment here I'm still waiting for some from last week's post!
-Ariel
ArielW@microsoft.com
7 Comments
Comments
John Gallardo [MSFT]
5 Aug 2005 1:49 PM
My thoughts are that the documentation should include the algorithmic complexity of a particular operation. For example, I might not need to know exactly how a particular operation is performed, but I would like to know what the cost might be to use a particular function. There are many libraries (the C++ STL comes to mind) that does a fairly good job of providing such information.
Dmitry
5 Aug 2005 3:11 PM
+1 to describe asymptotic behaviours for memory and speed.
Also could please describe the reasons for such a small set of collection classes?
Milan Negovan
6 Aug 2005 9:34 PM
Collections are my biggest pet peeve with .NET. :) I've posted my views on collections at
http://aspnetresources.com/blog/dotnet_collection_madness.aspx
and
http://aspnetresources.com/blog/dotnet_collection_madness2.aspx
.
Michael Vanhoutte
8 Aug 2005 3:26 PM
I agree with jgalla. Often I want to have an idea of the algorithm used internally, not because I really want to know how it works, but because I want to have an idea of how fast a particular method works. Since most of these algorithms are not documented, I currently use reflector to learn what I want to know.
Geoff Van Brunt
8 Aug 2005 4:32 PM
I agree, I often have to come up with a working solution just to test the performance of a collection/etc because there is no documentation on performance/algorithms are used. I've sometimes used reflector to dig through the code to figure out what is going on. Either way, not a fast way of gleening this information.
notgartner.com: Mitch Denny's Blog
9 Aug 2005 7:05 PM
Brien
20 Aug 2005 8:27 AM
Cool Ideas for the Collections API:
1. A performant dictionary that maintains insertion order (*cough* java.util.LinkedHashMap *cough*).
2. A performant dictionary that maintains sort order (*cough* java.util.TreeMap *cough*).
Page 1 of 1 (7 items)