Maxpm
Maxpm

Reputation: 25571

Is modularity important in libraries?

I'm about to start writing a library that aims to be as lightweight as possible.

This library will have several modules that can act independently, but can still work together to achieve a larger goal if the user so chooses.

Should I provide a means of compiling "just part" of the library? Should I wait until it gets big enough to be "worth it?" Where do I draw that line?

Upvotes: 2

Views: 152

Answers (1)

Stack Overflow is garbage
Stack Overflow is garbage

Reputation: 247969

If you want anyone to use your library (and like it), then yes, you need to make it more than just modular. Modularity implies that "these components are designed to be used together, and if you use them with anything else, it'll be an uphill struggle".

Each of your modules must be as easy to use from my code as they are from yours.

You need to treat each component as a separate library, not just as a separate module.

It is up to the user which libraries to pull in, and how to plug them into the user's code. With some kind of module system, you have already taken the architectural decisions and you try to force the user's application into your design.

Upvotes: 2

Related Questions