in reply to So much interconnectedness - good or bad?

To me, the term "module" tends to relate to the notion of "being modular", which gives a sense of being an independent piece that can easily be snapped together with any number of other independent pieces in order to make a vast assortment of different things, or used by itself just to do a particular task.

What you're describing seems different. Your A,B,C and D are not independent: if you need to use any one of them, you end up needing all four. It's not clear what sort of functional or objective specialization (if any) is leading you to make A,B,C and D separate, but if they're as interconnected as you say, maybe they shouldn't be separate.

Having a module depend on one or more others makes sense when the dependency is based on inheritance, or if the object defined in one module is supported by a "helper" or subordinate object in another module (like Archive::Tar, an object for a tar set, uses Archive::Tar::File, an object for an individual data file in the tar set). But a common property of such dependency is that it is unidirectional in some sense.

I'm actually a little puzzled about a design where "A uses D" and "D uses A". Why would these be two separate modules?

You haven't given enough detail, but one guess that comes to mind is that you could do a better job of dividing things up so that dependencies aren't going in all directions: the parts of D that are used by A and C might belong in a fifth module "E", which would then be used by A, C and D; and similarly for the parts of A, B and C that are used by D, etc.

Also, since these are modules, I'm assuming you're envisioning a set of apps that will use them. Is there ever a reason that an app would use D rather A (or vice-versa)?

If you haven't looked at Damian Conway's book Object Oriented Perl, it would probably be worthwhile to check that out.

  • Comment on Re: So much interconnectedness - good or bad?

Replies are listed 'Best First'.
Re^2: So much interconnectedness - good or bad?
by hakkr (Chaplain) on Dec 17, 2004 at 09:30 UTC

    Its all about easy resuse really, if you want to use A again somewhere else you are going to either have to unplug it from the rest or take them along as well even if they are not required.

    Also dependancies should be minimised as they are likely to break, and you cant test each component as a separate entity

Re^2: So much interconnectedness - good or bad?
by kiat (Vicar) on Dec 17, 2004 at 05:08 UTC
    Thanks, graff!

    I added the words most/a few functions of. Module B isn't entirely dependent on D. It uses one or two exported functions of D. I guess that still makes the design a bad.

    Later, I do hope to rewrite the smaller modules to make them OOish. Before that, I really have to get my hand on Damian Conway's book.