Re: are directories files?
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/26/04
- Previous message: cds: "send mail"
- In reply to: Tum: "are directories files?"
- Next in thread: nos: "Re: are directories files?"
- Reply: nos: "Re: are directories files?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 26 Feb 2004 06:27:43 -0600
"Tum" <spam@spam.com> wrote in message
news:%8j%b.28510$ws.3207260@news02.tsnz.net...
> Hi folks,
>
> I've been trying to make a decision and it's driving me crazy.
>
> Is a directory a file or is a directory NOT a file but a node?
>
> Should I have
>
> A)
>
> public interface IFile
> {
> IFileName FileName;
> IFileContent GetContent();
> }
>
> public interface IDirectory
> extends IFile
> {
> }
>
>
> or
>
> B)
>
> public interface INode
> {
> INodeName NodeName;
> }
>
> public interface IFile
> extends INode
> {
> IFileContent GetContent();
> }
>
> public interface IDirectory
> extends INode
> {
> }
>
>
> Method A is nice cause IFile becomes the base "Node" type and you can use
> names like "IFileName" which sounds nice compared to "INodeName" and fits
> with the "FileSystem" moniker. A has the disadvantage that IDirectory has
a
> GetContent() method which isn't bad but can be considered a bit weird. It
> probably wouldn't be too hard to make users think of everything as a file.
>
> Method B is nice cause IDirectory doesn't have GetContent() -- that honour
> belongs only to IFile. B is at a disadvantage when it comes to naming:
> everything becomes a "Node". INodeName sounds rude compared to IFileName
> and it's a bit weird to have everything based on something called a "Node"
> when the system is called a "File System" but this method feels more
"pure"
> in the OO sense cause you're specialising features completely.
>
> 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...
>
>
> ^Tum
>
Since java.io.File covers both files and directories, it's not exactly a new
way of thinking.
- Previous message: cds: "send mail"
- In reply to: Tum: "are directories files?"
- Next in thread: nos: "Re: are directories files?"
- Reply: nos: "Re: are directories files?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|