none
Interfaces and how to switch implementations RRS feed

  • Question

  • Hi,
    I have a question about interfaces, and how I should solve a particular problem of mine, as all this is quite new to me.

    My application will be able to access a file archive, using several methods. These may as the archive being mounted as a drive, or via ftp, or SSH access, thos are the methods I can think of at the moment.

    My main program should not know, or care what the access mode is, just that when it requests a specific file from the archive, it gets one.

    On the face of it, from what I have read, I believe the best way forward, is to have an interface, as this will be the common "interface" to the storage. This interface would have methods such as GetFileFromArchive(fileName).

    Then I could implement any way I need to for mounted drives, and ftp access etc.

    Does this sound the way to go, and the right thing to do?
    How would I switch between the different implementations, and can you?

    I would like to know these things before I launch into long nights of coding, just to get nowhere.

    Thanks,
    John
    Tuesday, August 4, 2009 8:10 PM

All replies