Menu

Change method signatures to accept interfaces

Ron
2006-08-19
2013-04-17
  • Ron

    Ron - 2006-08-19

    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.

     
    • Tim Gebhardt

      Tim Gebhardt - 2006-08-21

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.