1

I'm writing a library for general consumption (It's free software and open source). Is it okay to have a visible namespace (e.g. Library.Implementation) for implementation-only components that remain public for technical reasons (sharing between multiple packages/assemblies), but that aren't part of the library proper, and the user should avoid using?

I have mechanisms that could allow me to share the components while hiding them from users, but they're difficult to use due to technical reasons.

This wouldn't harm the integrity of the library, as the components are mainly utility code, and the library properly follows information hiding. Examples of the components include various conversion functions, a special variety of tuple, and some comparers. Users might even find the components useful, but they're not what the library is about.

4
  • Is your library free software or not? Mar 22 '15 at 17:52
  • Yes it is. Is that relevant?
    – GregRos
    Mar 22 '15 at 17:54
  • 4
    Personally, I think it's fine as long as your library's documentation has a little stub saying "don't use this stuff, it's only public for technical reasons and should be treated as implementation details that I might change at any time without warning". And your chosen license has the usual "I'm not liable for anything" clause. But I've never been in this position myself so I'm leaving this as a comment rather than an answer.
    – Ixrec
    Mar 22 '15 at 18:00
  • @Ixrec Should be an answer instead of comment ;) Mar 23 '15 at 8:19
3

In proprietary software you want to hide implementation details, while in free software you don't care (and you would accept someone extending your library in unexpected ways using the implementation datails). I also think it is related to the notion of leaky abstractions, and since you commented that your library will be free software, I would suggest putting the implementation part in some delimited "implementation" name space (or whatever your programming language supports).

You may add a comment saying that the implementation specific code is some unstable API which might change without notice.

Besides, a user of your library might both use the library for the intended main use and also use the implementation details for some other goals (of his main program).

That was originally a comment, that I slightly expanded to an answer per your request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.