title: Interview Q - Design File System - Review
body: <p>All,</p>
  
  <p>I was recently asked in one of the technical interviews to write a high level design for a File Sysem. My answer to the question was as follows. I would request everyone to please review and let me know if there are suggestions/improvement:</p>
  
  <pre><code>  interface BaseFileSystem
  {
      /*Basic file/folder attributes are:
        1. File/Folder Size
        2. File/Folder Date created
        3. File/Folder Date Modified
        4. File/Folder permissions - Read, write and execute
        5. File/Folder Owner - Owner of the file who defines permissions for other users
        6. File/Folder Visibility - Hidden or Visible
        7. File/Folder Name 
  
        Hence each one of the above attributes would have public &lt;return type&gt; get() and public void set&lt;AttributeName&gt;(&lt;variable datatype&gt;) */
  }
  
  public class File implements BaseFileSystem
  {
         /*The `File` class should implement all of the methods from interface `BaseFilesystem`.
           In addition, it must also implement following specific methods that can only be associated with physical files*/
  
          public String getFileExtension(){….}
  
          public void setFileExtension(String value) {….}
  
          public String[] getAssociatedPrograms(){ …..}
  
          public void executable(){ …. };
  }
  
  public class Folder implements BaseFileSystem
  {
  
        /*The `Folder` class should implement all of the methods from interface `BaseFileSystem`. In addition, it must also implement following specific methods that can only be associated with the physical 'folders'*/
  
          public BaseFileSystem[] getSubFoldersAndFiles(){ …. }
  
          public void addSubFolderAndFiles(BaseFileSystem fileObj) { …. }
  
          public void executable(){throw new UnsupportedOperationException();}
  }
  </code></pre>
  
  <p>Additionally, any general pointers to such design questions would be greatly appreciated.</p>