I’m trying to come up with a name for a class that can represent both files and folders. Anyone know a word for this?
5
Consider FileNode
or FileSystemNode
.
I’ve used FileNode
in previous projects, the other devs were able to guess what it did from the name. The -Node
part lets others know you’re working with a tree.
1
As everything (except the root folder or root of a drive) is ultimately contained within a folder, you could just go for FolderElement
, although FilesystemObject
(as suggested by @FrustratedWithFormsDesigner in a comment) also sounds good.
It depends on the operating system and the file system. On Unix, a directory is just a special file, so the correct term would be file.
NTFS has a similar unifying concept, albeit much more complex than on Unix, called attribute.
3
Why don’t you just call you class “FilesAndFolders” or do you have a character-limit for naming?
Well I guess you could call all of them entities, so: “FileSystemEntity”