Has any thought been given to change the signature of methods to accept a more general interface rather than a specific implementation?
MemcachedClient.FlushAll accepts an ArrayList of servers to flush yet the array of servers yet SockIOPool.SetServers accepts an string[]. If the FlushAll method were changed to accept an ICollection (a string[] would be better) then someone could create a string array and pass it into both the SetServers and FlushAll method.
In MemCachedClient there are a few methods that accept and return a Hashtable when a more general IDictionary could be used instead:
Hashtable GetMultiple()
Hashtable Stats()
I know I can cast that to an IDictionary myself but one problem with requiring a particular implementation of things is that things don't work if one day someone wants to use a HybridDictionary instead of a Hashtable.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Has any thought been given to change the signature of methods to accept a more general interface rather than a specific implementation?
MemcachedClient.FlushAll accepts an ArrayList of servers to flush yet the array of servers yet SockIOPool.SetServers accepts an string[]. If the FlushAll method were changed to accept an ICollection (a string[] would be better) then someone could create a string array and pass it into both the SetServers and FlushAll method.
In MemCachedClient there are a few methods that accept and return a Hashtable when a more general IDictionary could be used instead:
Hashtable GetMultiple()
Hashtable Stats()
I know I can cast that to an IDictionary myself but one problem with requiring a particular implementation of things is that things don't work if one day someone wants to use a HybridDictionary instead of a Hashtable.
This sounds good to me. This is something that's probably just held over from the port from the Java version.
My only problem is that it's a breaking change.
I'll log this change in the features/requests portion of the project.