Custom Strongly Typed Collections
While waiting to use Generics, one might consider using his own custom collections in his code. Why? Because it is more clear what to expect when you have a strongly typed collections. And the problem with the ordinary strongly typed object arrays is that they do not provide all the useful functions that i.e. ArrayList offers.
I have done in my previous projects quite a lot of switching from ArrayList to Array and vice-versa, but it is a bit annoying and error-prone. I think, sometimes it is better (and also gives developer a greater control) to use a custom collection(s) for your classes. So check out this good collection of collections resources! Good stuff! I tried these VS.NET templates and I liked them. Well, one might wants to modify them a bit to match his taste and needs, but still the idea is a great example of how to enhance the VS.NET IDE.
Well, you might think that this is an overkill. Especially if those collections are used only within a single project's scope by a fwe classes. If you develop the project in a small-size team, you can still pass ArrayLists around, and not burn your fingers often. But for public APIs this is obviously unacceptable.



0 Comments:
Post a Comment
<< Home