Friday, June 22, 2007

Whats next in the NSTL

After working a lot to extend the NSTL, a port and adaption of the C++ STL to .NET, on the algorithm and functional side, I had the choice between providing missing containers or experiment into the direction of LINQ. I first decided to head the LINQ direction, so I experimented writing overloads of algorithms using he .NET IEnumerable<T> interface directly. It showed quickly that it should be possible to write almost every algorithm of the NSTL in that fashion. The new "yield" iterator feature in C# 2.0 simplifies things a lot here, too. It also showed, that these overloads will provide a huge benefit in for .NET 2.0 users today. And last but not least, it showed that these overloads will be a lot of work, especially because of the case to case decision which overload is used to implement another to avoid code duplication and the pure amount of algorithms.

So I decided to plan this step more thoroughly, especially the unit test front. To bridge time and be able to ship a release in the regular schedule of 2-3 months I will provide provide a set of containers that are missing in the .NET world:
  • PriorityQueue<T>, which is a queue the always returns the element with the highest priority
  • Hashset<T>, a hash container that keeps a unique collection of items and offers constant time add, remove and contains access.
  • Hashmap<Key, Value> is like Dictionary<Key, Value> a hashtable. It differs from it by providing the possibility to change the values of the table while iterating over the keys
  • MultiHashmap<Key, Value> which extends Hashmap<Key, Value> with the possibility to store multiple values to a key
  • Deque<T> which is very similar to List<T>, except that it allows constant time insertion at both ends

No comments: