We've looked at some guidelines and tips for drawing module boundaries and creating modules. How about the process of creating APIs? This might seem obvious, but the standard best practice of a separate public API and private implementation still applies here.
The goal when designing the module API is to expose a standard, consistent, and possibly unchanging programming interface as the public API of the module. The details of implementation that are internal to the module should be encapsulated. This is, in principle, no different from method and member variable encapsulation for classes. Design a public API for your modules that you want the consumers to work with. The implementation details are hidden in encapsulated packages and serve two purposes:
- To reduce and simplify effort for the consumer so that they don't have to know the internals
- To allow...