File system organization for PoEAA-inspired systems...

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

File system organization for PoEAA-inspired systems...

Post by nielsene »

As I get deeper into the refactoring of my application along PoEAA lines, I'm starting to wonder if my include directory layout still makes sense. In the past the include directory looked something like

Code: Select all

include/classes/access-control/
                    database/
                    html-formatters/
                    phrasebook/
                    storeable-objects/
Most of the sub-directories had about 5-10 class files so it managed the "grouping" well.

Now I'm having an explosion of little classes that implement a given pattern, so I've been adding directories for "contexts","requests","controllers","handlers", etc. These are likely to have a large number of classes, 20+ each, easily.

In addition there's a clustering effect. Almost every handler has its own request. Contexts are almost similarly customized, though there is a litle more sharing, etc.

I'm a little tempted to re-orient the tree around functional areas, Each functional sub-directory would have its own controller with its associated contexts/requests/handlers. The few universally applicable/base-class can live in a "shared" or similar named directory. Any thoughts?
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

That sounds good. It means that "modules" can be added and removed simply by adding/deleting a directory.

For a library of general-purpose classes I'd probably group them by type: data access, filesystem, etc.
Post Reply