Re: are directories files?

From: S Manohar (sgmanohar_at_hotmail.com)
Date: 02/29/04


Date: 28 Feb 2004 23:49:34 -0800


> > > Do you reckon I can get away with Method A? It doesn't seem as pure
> unless
> > > you spend a long time convincing yourself that (for all intents and
> > > purposes) a file *is* a node (it's just got a different name) and a
> > > directory *is* a file.
> > >
> > > A penny for anyone's thoughts...
> > >
> > Since java.io.File covers both files and directories, it's not exactly a
> new
> > way of thinking.
> >
> This works
>
> File f = new File(".");

Wow, profound and epigrammatic replies, but of course it depends a lot
on how you are going to implement the interfaces.

E.g., are you going to have many functions that are common to both
files and directories (e.g. delete, move, attributes etc.)? And is
there much code that needs to be used by both classes? Code
economy/reuse is my major consideration when making these decisions;
it would be bad to rewrite routines twice that would operate on both
files and directories, e.g. recursive copying etc.

Since files have properties that directories do not (as you describe
with getContents), and Dirs have some that files do not, a common Node
interface sounds more attractive to me. Directories might also have
extras that files do not, e.g. the ability to add leaf 'nodes' to
them, and the ability to retrieve a list of their children - methods
which files do not.

Any more pennies?



Relevant Pages

  • Re: are directories files?
    ... > Wow, profound and epigrammatic replies, but of course it depends a lot ... > on how you are going to implement the interfaces. ... > with getContents), and Dirs have some that files do not, a common Node ...
    (comp.lang.java)
  • EDI BIZTALK Specialist needed in S.F. CA
    ... EDI Integration Specialist Job Description: ... Integrated Application Interfaces, and work flow process changes, EDI ... Demonstrates solid systems and/or business analysis skills. ... Ability to be self-driven and oversee multiple projects and implement ...
    (microsoft.public.biztalk.general)
  • Re: are directories files?
    ... > on how you are going to implement the interfaces. ... > it would be bad to rewrite routines twice that would operate on both ... > with getContents), and Dirs have some that files do not, a common Node ...
    (comp.lang.java)
  • Re: Is iCal the best in its field?
    ... Sometimes the ability to interface can be more important than the actual ... do you use Entourage by itself or have you found it interfaces ... Mail and other Apple apps? ...
    (comp.sys.mac.apps)
  • Re: The Point of Object Classes
    ... So it is true that one could create 'objects' in VB4, ... Ability to create ActiveX Controls. ... Ability to define multiple interfaces to group properties/methods into ... Ability to reuse interfaces in other classes. ...
    (microsoft.public.vb.general.discussion)