Re: Packages and source files "physical" organization
On 2008-10-27 05:11:20 -0400, Sohail Somani <sohail@taggedtype.net> said:
Vincent wrote:
Objects of class A must be used *only* into X::function1(),
X::function2(), ..., and X::functionN(). To improve the encapsulation,
I don't want that A is visible outside X. In other words, class A is a
"private" part of package X.
How would you organize, from a "physical" point of view, the source
files of package X?
The "trivial" solution:
packageXDirectory/X.h <- X's interface
packageXDirectory/X.cpp <- X's implementation
packageXDirectory/A.h <- A's interface
packageXDirectory/A.cpp <- A's implementation
does not satisfy me, because don't makes clear the fact that A is
private.
One option that I've used with some degree of success/failure is:
packageXDirectory/include/public/X/X.h
packageXDirectory/src/X.cpp
packageXDirectory/include/private/A.h
packageXDirectory/src/private/A.cpp
I say success because it is very easy to see what is "public" and what
is not.
Well, yes, but this isn't necessary, since the documentation describes
what's available to users of the library. Programmers who need this
kind of help are guessing at what things do and how to use them and
they deserve whatever happens to them.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]