Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design a file system [closed]

What should be the classes that one needs to create while designing a file system . What kind of of design patterns should be used in designing the file system.

like image 577
Niks Avatar asked Mar 21 '11 10:03

Niks


2 Answers

Sounds like homework. However, check out at least the following patterns:

  • Composite (files/directories)
  • Proxy (symbolic links)
  • Iterator (to traverse the FS)

You should as well google for "filesystem design patterns" to find lots of examples. Finally, read a good introduction to design patterns.

like image 74
Andrea Spadaccini Avatar answered Nov 18 '22 16:11

Andrea Spadaccini


If you're really looking for a list of design patterns to apply when designing a file system, you should consider

  • Composite for modelling directories/files
  • Decorator for allowing to associate additional properties (and possibly behaviour) to file system nodes.
  • Iterator for traversing the file system in different ways
  • Factory for creating file system nodes with different backends (e.g. a disk-based file system or a memory-based file system or a remote file system).

I think that this general approach of trying to apply all the patterns you can is wrong though, it's easy to overengineer your software like that. The key insight with design patterns is to realize when you should not apply a pattern.

like image 37
Frerich Raabe Avatar answered Nov 18 '22 16:11

Frerich Raabe