I am currently issuing a problem while forming the program-design, which is exact like a File-Directory relationship, and to ease it, I am using that as an example.
I think it is usual, that a
Directory has a collection of it's
I take this as kinda axiom, correct me if this is not usual.
But , when there are events occuring on a file, and the directory wants to be notified with those changes, the file has to have a reference to it's directory in some way:
- A) The direct way:
Fileclass has a reference to it's
- B) Through Callbacks/Event-Handling:
Fileclass has a reference to a function of it's
- C) The
Directorychecks the properties of the
Filein an intervall.
I really hate this 'solution' because I think it is unperfomant as hell.
Both (A, B) ways are creating a circular dependency (many cons) and require the
Directory of a
File to be instantiated before itself, unless I lazy-init the
Files reference (should I?).
So how are those File-Directory relationships designed? Do they have a circular dependency, an intervall check, do they use lazy-init...?