vendredi 20 mars 2015

What is the preferred way to approach this problem in object-oriented desing? - virtual disks abstraction


I am writing a program that manipulates encrypted virtual disks and encrypted flash drives (eg. importing disks into my application, mounting/unmounting, changing passwords etc.). I am still new to object-oriented design so I have run into the following problem.


I have identified three disk types:



  • Disk stored in a file (virtual disk) on a hard-drive (fixed location)

  • Disk stored in a file (virtual disk) on a removable device (eg. flash drive, absolute path can change)

  • Encrypted flash drive (same as above but stored directly on the device so no filepath)


The operations i need to do over these disks are mounting, unmounting, checking for presence on the computer and changing password. The main problem i have is with the differences (and similarities) in storing their location (file on a hard-drive can do with only an absolute filepath; encrypted device can do with a device ID; file on a removable device needs both device ID and a relative path on the device).


I have came up with multiple solutions so far but none of which I liked. Is there a preferred way to do this? Or am I thinking about this the wrong way?





Aucun commentaire:

Enregistrer un commentaire