Type dependencies vs directory structure

Posted by paul on Programmers See other posts from Programmers or by paul
Published on 2013-06-26T16:15:20Z Indexed on 2013/06/26 16:28 UTC
Read the original article Hit count: 302

Something I've been wondering about recently is how to organize types in directories/namespaces w.r.t. their dependencies.

One method I've seen, which I believe is the recommendation for both Haskell and .NET (though I can't find the references for this at the moment), is:

Type
Type/ATypeThatUsesType
Type/AnotherTypeThatUsesType

My natural inclination, however, is to do the opposite:

Type
Type/ATypeUponWhichTypeDepends
Type/AnotherTypeUponWhichTypeDepends

Questions:

  • Is my inclination bass-ackwards?
  • Are there any major benefits/pitfalls of one over the other?
  • Is it just something that depends on the application, e.g. whether you're building a library vs doing normal coding?

© Programmers or respective owner

Related posts about libraries

Related posts about organization