I see a lot of APIs that use custom collections instead of just using strongly-typed packaged generics.
For instance, the API will have a Object1Collection
instead of just a List<Object1>
(or whatever the appropriate generic would be).
When do you know to use one or the other? I understand you'd create a custom collection if you want to extend the capabilities of a pre-shipped generic collection, but what if that's not the case?
Is it prudent to create the custom collection from the beginning, with thoughts that in the future that object might scale up and require further capabilities, and it may be easier to just do that initially? Is that justification enough?
And if you just want to extend functionality, instead of define collection functionality, you would just derive your custom collection from a base generic collection class, otherwise inherit the interface accordingly? Is that typical?
CustomCollection cc
look any cleaner thanList<myType> cc
? – Adam Zuckerman Apr 2 '14 at 0:54FooCollection
is lest I look up how it is implemented. If I see aList<Foo>
, I know straight away what it is. If allFooCollection
does is provide a "clean" alias for a well-known native .NET type, I say it's a bad move – Konrad Morawski Apr 2 '14 at 6:45