[Solar-talk] Project structure layout?

Antti Holvikari anttih at gmail.com
Wed Nov 14 04:13:12 CST 2007


On 11/14/07, Jeff Moore <jeff at procata.com> wrote:
>
> On Nov 13, 2007, at 8:27 AM, Paul M Jones wrote:
>
> > Comments, criticism, analysis?
>
> One of the things that I think can get lost in organizing files by
> type is the concept of a working set of files.  For some files, you
> always work on those files together, even if they are of different
> types (or different roles in pear speak).  Storing them in separate
> file system locations can make working with them slightly harder.
>
> For me, the best example of this are the unit test files.  Since you
> almost always work on both the tests and the code under test at the
> same time, having both files in the same directory makes opening files
> during development slightly easier.  It also highlights that
> relationship between the files and especially highlights missing test
> code.
>
> Depending on the division of labor at your organization, the same may
> be true of other kinds of related files, templates and controllers,
> perhaps.
>
> This desirable locality of reference during development seems to
> conflict with the need to place different kinds of files in different
> places for the application to easily and efficiently find them at run
> time.  If you optimize for locality of reference to make development
> easier, it makes the code for locating those files at runtime more
> complicated and the differences between the development and production
> environment greater.  If you optimize to make it easier for the app to
> locate its files, you make the system harder for people to understand
> and work with because files that are worked on at the same time are
> spread across several directories.  Maybe there is no good solution to
> this conflict.

The example Paul gave was missing a tests dir for the "Project" which
is the project you are actually working on with that setup (you are
not working with the ext/ projects neccessarily, they're just external
dependencies). So, what I suggest is to put the tests for Project into
the php dir, which would bring the tests "closer".

  php/                    # unified include-path
        Project.php         # arch-class for this project
        Project/            # files for this project
        tests/               # tests for Project
        ....

Or put then in the top level. Does this make any sense? Any other suggestions?


-- 
Antti Holvikari


More information about the Solar-talk mailing list