K
kk_oop
I've got a question about "component" dependencies in C++. For
this discussion, I'm considering a component to be a group of classes
that implement a service provided to other components via an interface
or via a service request message.
Consider component A and B. B offers a service processWidget. This
service is invoked by A sending a ProcessWidget message to B. The
message is represented by the header file ProcessWidgetMsg.h.
My directory structure is set up so each component has a root
directory named after the component. So in this example, we have peer
directories A and B. Under each of these directories are the
respective component's implementation files or subdirectories
containing implementation files. Let's say in this example, B has a
subdirectory called WidgetProcessor and that contains various .h
and .cpp files that know how to process a Widget.
Here are my questions:
1. If I put a Messages folder under B and store the
ProcessWidgetMsg.h file there, would you consider component A to be
dependent upon component B? I'm thinking it would be, since A needs
a .h file under B's file hierarchy (the ProcessWidgetMsg.h file).
2. If instead of doing that, let's say I created a Messages directory
as a peer to A and B, and I placed the ProcessWidgetMsg.h file there.
Would you still consider A to be dependent on B, since A still
requires B's service? I know there would be no physical dependency in
this case, but would there be utility in documenting that A has a
logical dependency on B?
Thanks for any opinions!
Ken
this discussion, I'm considering a component to be a group of classes
that implement a service provided to other components via an interface
or via a service request message.
Consider component A and B. B offers a service processWidget. This
service is invoked by A sending a ProcessWidget message to B. The
message is represented by the header file ProcessWidgetMsg.h.
My directory structure is set up so each component has a root
directory named after the component. So in this example, we have peer
directories A and B. Under each of these directories are the
respective component's implementation files or subdirectories
containing implementation files. Let's say in this example, B has a
subdirectory called WidgetProcessor and that contains various .h
and .cpp files that know how to process a Widget.
Here are my questions:
1. If I put a Messages folder under B and store the
ProcessWidgetMsg.h file there, would you consider component A to be
dependent upon component B? I'm thinking it would be, since A needs
a .h file under B's file hierarchy (the ProcessWidgetMsg.h file).
2. If instead of doing that, let's say I created a Messages directory
as a peer to A and B, and I placed the ProcessWidgetMsg.h file there.
Would you still consider A to be dependent on B, since A still
requires B's service? I know there would be no physical dependency in
this case, but would there be utility in documenting that A has a
logical dependency on B?
Thanks for any opinions!
Ken